Introduction to Git

4 minute read

Introduction to Git


Git is a distributed version control for tracking changes and to maintain multiple versions of code during the development of a software project. To understand Git, we should understand version control.

Version Control

A version control a.k.a source control a.k.a revision control is an application that helps to maintain versions of a code. Before we continue any further, we must know some important terms that will be used while we study version control:-

  1. Repository: A repository is a place to store the code and other files created and modified during the development of the application. A repository also maintains the history of the code and other files generated during the development of the program.
  2. Trunk: Trunk is the master branch of the git repository. That is, it is the main development line of the repository. All the branches merged will at last merge with this line to form the main line.
  3. Tags: Tag is a descriptive name given to a specific version of the project. It forms as an memorable alternative to the id generated by version control.
  4. Branch: A branch generates multiple development lines for the repository. This feature helps when there are multiple people working on the same project.
  5. pull: Pulling is the process of downloading recent changes from the central repository to the computer’s local repository. If the repository is being downloaded for the first time, it is called cloning.
  6. Pushing: Pushing is the process of uploading all the changes into the central server.
  7. Committing: Committing is the process through which the version control records and stores changes to the central repository. The committing process also helps to document the changes done by the developer.

That is, each change in the program’s code can be recorded during the development of the application. The major advantages of version control are:-

  1. If the developer’s recent change has crashed, he/she can revert back to his previous versions.
  2. A developer can compare different versions of his code for bug fixing, release documentation and many more purposes.
  3. Version control helps in efficient usage team members during development of group projects as multiple developers can contribute to the project. Each developer can track changes done by each developer to the project.
  4. Version control supports branching, a method to create multiple workflow that doesn’t affect the master branch. The developer can also merge these multiple branches to the master line.
  5. Acts as a backup for the code.

A version control works on the principle of graph data structure. That is, each change recorded during commit forms a node in the graph data structure.

Version control flow

The above image is self explanatory on how version’s branching and merging works using graph data structure.

Types of Version Control

The types of version control are:-

  1. Local version control
  2. Centralized version control
  3. Distributed version control

A local version control maintains versions of the code on the local computer. One of the most common methods of maintaining versions is local version control. The versions are maintained as different files. Due to this methodology, there is a great chance for accidental loss of data due to accidental changes to the wrong file.

A centralized version control is a version control approach through which different versions of the code are maintained on a centralized server. A centralized version control can store versions of code and has a list of user’s who has the privilege to access the repository (Central code). An example of centralized version control is Tortoise SVN.

A distributed version control is a type of version control system that helps to clone the repository in which the code is present along with it’s full history. The main advantage of this method is that, if any of the central servers fails, the developer can restore the repository by uploading (pushing) the code to the server. That is, a distributed version control creates a complete backup of the repository into the local computer. An example of distributed version control is git.

The popular version systems are:-

  1. Git
  2. SVN (Apache Subversion)
  3. Mercurial

What is Git?

Git is distributed version control application that comes under General Public License 2 (GPL 2). Git was developed by Linus Torvalds during the development of Linux kernel in 2005. As git comes under distributed version control, the local repository of projects developed using git will have complete history of changes irrespective of internet access or access to the server. Git is developed using C, Python, TCL,Perl and Shell.

Installing Git

Ubuntu / Debian

$ sudo apt install git-all


$ sudo dnf install git-all

Centos / RHEL

$ sudo yum install git-all


You can install git using brew package manager as follows.

$ brew install git

Or, you can install as follows:-

  1. Download git for mac from this link.
  2. Execute the installer and follow the steps to install git into mac.

But, I would prefer to use brew because you can update the application easily by just executing brew update.


  1. Download git for windows using this link.
  2. Execute the installer and follow the steps to install git into windows.

Categories: ,


Leave a comment