Git Introduction



This is an introduction to Git tutorial.

What is Git?

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.

Why use Git?

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.

How to install Git?

Visit and download the latest version of Git for your OS. It is available for Mac, Windows and Linux.

Installing on Mac

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

Installing on Windows

Download the latest version from git-scm. For more details check this.

Installing on Linux

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.

What is Version Control?

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.

Types of Version Control Systems

There are three types of VCS.

  • Local
  • Centralized
  • Distributed

Local 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.

Centralized VCS

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.

Distributed VCS

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.