• Facebook
  • Twitter
  • Linkedin


Posted by admin on November - 10 - 2016

GIT is a version control system which is used for software development. Git was created by Linus Torvalds in 2005 for development of the Linux kernel.

Distributed version control system

Version Control System (VCS) is a software which helps software developers to work together and maintain a complete history of their work.

Functions of a Version Control System:

Allows developers to work simultaneously.
Does not allow overwriting each other’s changes.
Maintains a history of every version.

Types of VCS:

Centralized version control system (CVCS).
Distributed/Decentralized version control system (DVCS).

Distributed Version control system

  • Centralized version control system (CVCS) uses a central server to store all files and enables team collaboration. The major drawback of CVCS is failure of the central server or central server may get down an hour, then during that hour, no one can collaborate at all.
    The worst case is, if the central server’s disk gets corrupted and proper backup has not been taken, then will lose the entire history of the project.
  • DVCS clients not only check out the latest snapshot of the directory but they also fully mirror the repository. If the server goes down, then the repository from any client can be copied back to the server to restore it. Every checkout is a full backup of the repository.
  • Git does not rely on the central server and that is why you can perform many operations when you are offline. You can commit changes, create branches, view logs, and perform other operations when you are offline. You require network connection only to publish your changes and take the latest changes.

Advantages of Git

  • Free and open source
  • Fast and small
  • Implicit backup
  • Security
  • No need of powerful hardware
  • Easier branching

DVCS Terminologies

Local Repository:
Every VCS tool provides a private workplace as a working copy. Developers make changes in their private workplace and after commit, these changes become a part of the repository. Git takes it one step further by providing them a private copy of the whole repository. Users can perform many operations with this repository such as add file, remove file, rename file, move file, commit changes, and many more.

Working Directory:

The working directory is the place where files are checked out. In other CVCS, developers generally make modifications and commit their changes directly to the repository. But Git uses a different strategy. Git doesn’t track each and every modified file. Whenever you do commit an operation, Git looks for the files present in the staging area. Only those files present in the staging area are considered for commit and not all the modified files.

Basic work flow of Git.

Step 1 : You modify a file from the working directory.
Step 2 : You add these files to the staging area.
Step 3 : You perform commit operation that moves the files from the staging area. After push operation, it stores the changes permanently to the Git repository.

Suppose you modified two files, namely “small.c” and “big.c” and you want two different commits for each operation. You can add one file in the staging area and do commit. After the first commit, repeat the same procedure for another file.