2 Mar 2016

Understanding what GIT does under the hood rather than only learning commands and wondering

you can only really use Git if you understand how Git works


You get a .git folder when you do git init or git clone for the first time. That's your repository. Sometimes also referred to as local repository.

A git repository contains, among other things, the following:
  • A set of commit objects.
  • A set of references to commit objects, called heads (branch, tag and SHA1 names are types of head).

Remote Repository

If you have cloned from somewhere, so the URL/path (yes it can be local or on network also) you used to clone contains your remote repository. It is identical to what you get in your .git folder after cloning. `git remote -v` command lists all remotes available in the current repository and it's URL.

How GIT stores your commits or commit objects

A commit object contains 3 main things:
  • Reference to the parent commit
  • Changes  (adds/updates/deletes of words/lines/files) since parent commit or changes of this commit (it doesn't store whole file as it happens in centralized Version Control Systems like SVN/TFS/VSS/Perforce)
  • An SHA1 name(38f7a44232faf4651dc085495e4ea770c951d7b2), a 40-character string that uniquely identifies the commit object. The name is composed of a hash of  relevant aspects of the commit i.e. changes, timestamp, parent commit SHA1 name, author etc.


Branches are basically references of commits or easy way to refer to commits i.e. ugly SHA1 name. In some of the cases when you merge/rebase, these markers for SHA1 name move from one commit to another commit rather than moving/modifying around multiple commits. We will get to know more about it in upcoming parts of this series.

Credits: This post is inspired by Understanding Git Conceptually.


  1. Really it was good information and good article. Keep more sharing. Web Design Companies Bangalore | Website Designing Bangalore

  2. vIt was a great information and Its really worth reading it. The author did an mind blowing work by describing each and every concept in detail. Thanks for such an informative post. Please keep up your good work.
    ECE Colleges in Chennai

  3. For best and cheap manual Seo services, Web designings. Must check Web Development Company India