Have you got the ‘GIT’ yet?!

Most of us are familiar with the Version Control system and it’s uses. To those of you who are not familiar with it, here it goes-

“It is a system that manages the changes that are done to a set of files, Every time changes are made to the files they are referred using the revision number with respect to the original version and each revision is associated with a timestamp and the person who makes the changes”

Git is one such Version Control System that gives the users more powers to carry out these tasks. It is a command-line tool which does not provide us with Web-based graphical interface,access control and several collaboration features such as bug tracking, feature requests, task management, etc unlike the GitHub.

The Git commands are extremely powerful for version controlling in projects involving people working on various domains and areas. Apart from version controlling, the Git is also capable of tracking the history of a collection of files.

It supports creating different versions of a collection. Each version captures a snapshot of the files at a certain point of time and the version control system allows you to switch between these versions. These versions are stored in a specific place, typically called a repository.
This gives us the added privilege of reverting the collection of files to a state that existed  2 days ago,or you may switch between versions of your files for experimental features.

A quick look at the basic Git commands

$sudo apt-get install git

This installs Git in your system.

$git config

This allows us to setup Git configuration mostly useful when we are setting up GIT for the first time.

$git init

This initializes a new local Git repository.

$git clone <git-path-to-the-repository>

This creates a working copy of the local repository.

$git help

Forgot a command? Type this into the command line to bring up the 21 most common git commands. You can also be more specific and type “git help init” or another term to figure out how to use and configure a specific git command.

Note: Remembering to use this command would be of a great help at times when we tend to forget few important commands.

$git status

This gives the status of the local repository at any instance of time.

$git pull origin master

This helps us to pull the changes made in the remote repository onto the local repository.

$git add <path-to-the-file(s)>

This helps us to include the new file(s)/folder(s) into the repository, this is referred to as ‘Staging’ the changes.      

$git commit -a -m “message”

This helps us to commit the changes made in the local repository, this can be done only to those file(s)/folder(s) that have been staged ie. added. Committing literally means taking a snapshot of the files at that instance of time.

$git push origin <branch-name>

This enables us to push all the changes made in the local repository to the remote repository ie. with regard to the ‘branch’ we would be referring to.

$git remote add origin <git-repo-path>

This helps us to establish a connection between the local repository and the remote server.



This covers the basic understanding about the Git and how one could explore it’s commands to have a better version controlling feature while working on distributed code base.



  • Jiří Pejchal

    September 14, 2015 at 11:54 pm

    sudo is needed only for git installation (root privileges needed). The other commands should be without sudo.

    • Kewal

      September 15, 2015 at 12:41 am

      Hi Jiri,
      Thanks for pointing it out. We have updated the post.

Comments are closed.