This is an introduction to Git tutorial.
Git is one of the most widely used distributed VCS or Version Control System. It is FREE and Open Source project and was started in the year 2005 by Linus Torvalds.
Linus Torvalds is also the creator of the Linux OS kernel.
We use Git when we want to keep track of the changes done to a file or files in a project. It is useful when more than one person is changing the same file or working on a same project.
Visit git-scm.com and download the latest version of Git for your OS. It is available for Mac, Windows and Linux.
If XCode is installed then your Mac has Git. Apple maintains their own Git which you can check here.
Once installed run the following command to check the version of the Git.
$ git --version git version 2.10.1
Open terminal (shell) and install Git via apt using the following command.
$ sudo apt-get update $ sudo apt-get install git
Once the installation is complete you can check the version of the Git using the following command.
$ git --version
Lets talk briefly about Version Control Systems.
Version control is a system that keep records of all the changes done to a file or files over time and helps us to switch back to any version.
There are three types of VCS.
This is local to a computer. In this we keep copies of the changes done to a file.
Example: The Revision Control System, short RCS, is a set of applications which allow a system to persist the history of changes. RCS works by keeping patch (difference between files) and can recreate a file by adding up the patches to achieve how it looked like at any point in time.
In this setup we have a centralized server containing all the versioned files. And we have clients who are connected with the server and check out files.
This helped in collaboration between developers.
Drawback of this system is single point of failure. If the main server goes offline or gets corrupted/destroyed then every client connected with it loses the versions and can no longer sync their work.
Example: CVS, Subversion, and Perforce.
To overcome the drawbacks of the Centralized VCS we have the Distributed VCS. In this setup we have a centralized server which keeps the all the versions of the files. And we have the clients who not only check out files but they also keep full copy of the repository changes.
So, if the central server goes offline or gets corrupted/destroyed then any client can copy its repository and restore the server.
Example: Git, Mercurial.
Thanks for reading this tutorial. In the next tutorial we will learn to configure Git.