Control Versions- The Git Way

Start Here

Get in touch with a
TriCore Solutions specialist

Blog | Jun 3, 2016

Control Versions- The Git Way

Git is a distributed version control and source code management system, which emphasizes speed, efficiency and data integrity. It’s a free and an open source system.

For a hardcore programmer, changing requirements and exponentially growing source codes makes it difficult to manage and keep track of the last modifications and backups.

Git is a small, speedy and efficient system to satisfy this requirement, without having to have powerful hardware.

In the era of cloud computing, there is no excuse for lost data anymore. Keeping a backup of your data and even collaborating with others has become very easy using Git.


Git is a distributed version control and source code management system, which emphasizes speed, efficiency and data integrity. It’s a free and an open source system.

Being a distributed system, there are minimal chances of data loss. It allows more than one developer to work together, without overwriting the source code.

Refer to the Git Workflow:

Git Workflow

Git terminology

When using Git, one will come across some basic terminology, we will familiarize you with that in some of the examples below.

Create an initial git local repository using   - git init

The working directory - This is where you modify the files. You need to do this in order to review the modifications before adding it to the staging area.

  • Git status - List the file names which are modified or not committed.
  • Git diff <filename> - list the differences in the modified files from the last commit status.

The staging area – Add the edited files to the staging area using

  • Git add <file name>

Git repository Commit operation moves the files from the staging area and push operation saves the changes to git repository under a unique revision history.

Tree Tree represents a directory and contains sub directories.

Branches Branches are generally used to start a new feature development. Ideally a new feature is committed in a separate branch which ultimately is merged into the default master branch. It enables a developer to choose select and unselect in the functionalities for a particular version of the source code.

Commit Commit can be seen as an index of the repository. Every commit points to the parent commit object. The commit command should be followed by a comment to indicate the purpose of the modifications.

  • git commit –m “Indicating the usage of commit command”

Clone Clone operation is used to create an instance of the repository. Suppose we have a working copy of the source code in git repository, it can be fetched using clone and can be treated as a new working directory.

  • git clone <Git repo URL>

Pull Pull operation is used to copy the current changes in the source code from the remote repository branch to the local repository which may be committed by any developer working on it.

  • git pull master

Push Push operation is used to save the modified files into the Git repository creating a revision. It is used to copy the changes from a local to a remote repository.

  • git push origin master

Head Head is a pointer which points to the latest commit in the branch.

Revision – Revision is known to show the version of the source code saved in the git repository. Whenever we need to revert a change from the staged area, we need to give the unique head pointer with the checkout command. 


  1. Initialize Git. This will provide the working directory where modifications can be made to the source code.
  2. Create a sample file “”
  3. Check the git status, if it lists out any new or modified files.
  4. You will notice that “git status” will list out the as an untracked file, which means you need to add and commit the file to the initialized git repository.
  5. Add “” to move the changes from working directory to the staging area.

create git repository

6. Check the git status , if the “” is available in “Changes to be committed list”

git experts

7. Commit the file to move it from the staging area


8. Push command to save the changes to the git repository


Conclusion: Git can efficiently handle all the basic operations that a project versioning may require, which includes:

  1. Creating or cloning a repository
  2. Team work on the project by creating various users with required permissions.
  3. Feasibility to create individual branches for each functionality
  4. Pull the latest changes in the branch
  5. Staging and committing the changes
  6. Reverting or fixing the troublesome block of code
  7. Stashing the changes to switch branches
  8. Push the changes to the repository
  9. Viewing repository logs
  10. Master branch always as rescue in case of any branch failure.

It is a great platform for aspiring developers to keep a track of their progress without even paying for it. Also a great sub versioning tool used by corporations to keep their assets safely trackable. For any questions on the topic click below. You can also leave a comment. Thanks!

Ask Charu