# Getting started with Git

In this Blog you will get a complete basic introduction to GIT and Version Control System.

<h1>What is Git ? </h1>
Git is a free and Open source software for the Version control of your file, Version control is the practice of tracking and managing changes to the code. Version control system helps the teams to make changes to source code over time.

Things that Git allows us to do- 
1. First thing Git allows us to revert a selected file or an entire project back to previous state because it is maintaining versions of your project.
2. It also allows you to compare changes over time.
3. Git allows you to see who was the last person modified the project or made some changes in the project or who last modified the files that's causing some issues.
4. It also tells you who introduced an issue in your project and when did they introduce an issue, and Git allows us to do many other things as well.

<h2>Three types of VCS (Version Control System)</h2>
- <h3>Local VCS</h3>  
The concept behind Local VCS was, they had a Database which maintained all changes in the file. Local VCS used to store changes to a file in a local database, but local VCS had a problem that any developer would face was whenever we are working on a project, and we want some folks to get involved, collaborate with other developers to make some changes in source code and this Local VCS was not useful in this case.
You can maintain the versions on a Local DB but can't collaborate with other developers.

![File.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1665125898628/RIZvyIHeo.jpg align="center")

- <h3>Centralized VCS</h3>
This VCS used to have a single server which used to contain all versions for developers who used to contain all the versions for developers who used to work on a project. Whatever changes other developers making in project this used to be maintained on a remote server, and on this server all the developers can make changes in the source code, and send it to the server.
This VCS also had some issues and that issue was this system had a single point of failure, When the server is down none of any developers would be able to push changes to the server and the second issue with this VCS was if the hard disk in that server goes corrupted, it loses all the data and it doesn't store the backup of that data.

![File (2).jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1665141185505/NLSrALf5l.jpg align="left")

- <h3>Distributed VCS</h3>
In this system every developer working on the project only going to have one version of their project at a time. But this time what happens is whenever you are cloning this project you are going to have an exact thing with entire history. Instead of just having a single version in their system they will have the entire thing, and if the server is down or the hard disk gets corrupted, and the server doesn't exist any more even then there is no loss of data and both the developers still have the entire thing with them.
This is the Distributed Version Control System in which instead of the server having the entire history whenever we clone the project we get the entire history.

![File (3).jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1665141199445/zp73Cnbda.jpg align="left")


<h1>How was Git created ?</h1>
In 2002 Linux Kernel Community started using distributed VCS known as BitKeeper and the father of Linux who created Linux wanted to create a new Distributed VCS. They encountered lots of problems in Distributed VCS, he wanted to learn from these problems and create a D-VCS that solved all these problems
that Linux Community faced with BitKeeper.
That issues were speed, simple design, strong support for non-linear development (In which multiple things can happen parallelly), they wanted the system to be fully distributed and the ability to handle large and complex project efficiently, and that is when Git was born.

<h1>How Git is different from other VCS ?</h1>
- The first thing that is there in Git is **Snapshots**, Git actually takes snapshots of what the files look like, it creates a reference to that snapshot. Instead of maintaining changes like previous one changes to the base file that was there, it will instead take a picture of file system and files that are there and saving it.

- Second reason why Git is different from other VCS is nearly every operation is local. Even if you are offline you can still commit changes and store it in your Git database, instead of asking any remote server it's going to look for the local version that was available one month ago, and it's going to show the difference to you.

- Next reason why Git is different from other VCS is that it has Integrity, Git will know each and every change you're making because everything in Git is check summed and because of that you're not going to lose any data and also your files not going to get corrupted. Git uses SHA-1 mechanism for check summing, this mechanism is 40 character string and this string calculated based on content of file. So, if you add or remove a file that goes into a directory structure criterion and if you modify a file it goes into a content of file criterion but whatever changes we make this string is always going to be unique since it is calculated based on directory structure or content of a file.

- Last reason is it only adds, whatever you do on Git all of it is only going to add some data into git, it won't delete anything. It's very hard to erase some data from database.





