What is Git?
Git is a free and open-source distributed version control system (VCS) designed to handle everything from small to very large projects with speed and efficiency.
It is a revert to your files and project in their previous state.
It compares the changes that you have made today to the previous.
It also tracks the record of what you have done in the last month and who has made these changes.
Last but not least, it is also important to track what kind of issues are in your project and who introduced them and when.
Why do we need a Version Control System?
When you make a project, at that time you like your design, but after some days you realise that your design is not good, so at that time, VCS plays a good role because it is reversible.
So that is the major reason for using the Version Control System.
Now we deep dive into the Version Control System.
Local Version Control System
Local VCS means it is a file system that is on your computer or laptop.
Once you have made one file, it is your version-1 file. Then you will make a change in the file that is your version-2 file. Now again you will make a change that is your version-3 file.
That kind of structure in local VCS is so simple, but it has some failures.
Failures
When we are working on a large project, at that time, we need to collaborate with our team members, but that feature is not available in this VCS.
The second failure is that team members make changes to the project that are not visible to you. So that is a major issue with local VCS.
We are engineers; we identify problems and begin developing solutions.
Centralised VCS
So we discovered a solution to local VCS failures: centralised VCS.
In this VCS, one server is centralized, which maintains all the project code and documentation.
When we are working on a project, at that time, we have lots of team members available. Here we have a centralised server that takes care of all the code of our project. When developer-1 needs to change something in code, he will clone/download the files and make the change and upload it.
Same thing developer-2 will do and developer-3 will do. So now we have solved our problem using this centralised VCS.
But it also has some failures.
Failures
The first failure is that whenever the server goes down at that time, you will not be able to push/upload your changes or download the latest version.
The second problem is that if the hardware goes corrupted at that time, we lose all the data. So we have no backup for that.
Distributed Version Control System
Now again we have a problem and we found that solution and that is Distributed VCS. So in this VCS, one centralised server is there, but that server is directly connected to each of the members' accounts.
Using that, the developer established a direct connection with the server, and he or she is now cloning/downloading all versions of the project in his or her local system.
So whenever the server goes down or hardware gets corrupted, at that time you have a backup for the project on your local system. -So that is a major benefit, or you can say the major solution, for issues that we have faced in previous VCS.
The History of Git
In 2002, a Linux company was using a Distributed VCS called BitKeeper, and at that time it was free for Linux.
However, after the Linux kernel company and the commercial company fell out in 2005, Bitkeeper decided to take charge of using their VCS.
At that time, the father of Linux, Linus Torvalds, decided to create our own distributed VCS.
And now Git comes into the picture.
In this distributed VCS they tried to solve some problems which were faced in Bitkeeper, and that was
Speed 1. Simple layout
Storage support for non-linear development
widely dispersed
Large-scale project efficiency
How is Git different from other distributed VCSs?
Snapshot :
Other distributed VCSs are used to store their versions in a database and that is known as Delta Based VCS.
In this VCS, they use the base file to change their version accordingly.
File-1 will change based on its base, and the next version-2 will change based on file-1, and version-3 will change based on file-1.
So that was how they changed their version.
But in Git, they take a snapshot of their previous version and then make a change to it. But that is not based on the base file system.
It's only used its previous version of that file.
Nearly every operation is local:
In this difference, most of the distributed VCS have a centralised server.
So whenever we need to work on our project at that time, we need to download all the files. That is a boring and lengthy process every time.
But in Git, there is no need to download/clone every time. You just clone the project and it will be available on your local system.
Integrity:
Git tracks all the activities that you have performed today and last month.
In Git, everything is checked. So the SHA-1 mechanism is used. But other VCSs, do not have these kinds of facilities.
Only adds generally:
In Git, it adds our code and whenever we delete our previous version, that is also stored in its system.
But in other VCS, there is no record of deleted versions. Thanks for reading and I will see you in my next blog. Also, you can follow me here Twitter
Please see Apoorv Goyal for more information.