Monday, July 25, 2011

Working with Git - Part 1 - Our initial experience

When Adku first opened shop, we used Subversion for source control. Since then, we’ve migrated over to the wonderful world of Git and wanted to share why we moved and some aha moments we’ve experienced along the way.

Why we moved to Git
  1. Speedy commits and updates, subversion commits got to be painfully slow - sometimes taking minutes
  2. Cheap local branching
  3. Better merging. e.g. merges follow renames and code moves
  4. Better support for file renames and file permission changes
  5. Interactive commits or the ability to commit partial files

Our aha moments
  1. A “commit” is essentially a diff with a pointer pointing to the commit we created a diff from
  2. A “branch” is a pointer that can be updated to point to any commit
  3. Deleting a “branch” is akin to deleting the pointer to that commit, if you have another “branch” (pointer) pointing to that commit, your changeset will NOT disappear
  4. A “remote” is a reference to a clone of this repository. This clone is usually hosted on another machine but it can also be another repository on your own hard drive.
  5. “git pull” is effectively the same thing as a “git fetch && git merge”
  6. “git fetch” is safe to re-run and does NOT update any files in your branch. It updates your knowledge of where the “remote” repository thinks it is.
  7. “git rebase origin/master” works by uncommiting all your commits in reverse order, updating your branch to origin/master, then replays your commits in order
  8. Your repository will continue to think a branch exists on a “remote” repository even if it was deleted by another developer. To remove branches that don’t actually exist on the “remote” anymore, you can run “git fetch --prune”

At the end of the day, we realized that these insights did not come cheaply. We invested a lot of time trying to understand Git and we recognized that we could not afford to have every new hire spending weeks getting up to speed on a version control system.

We ultimately decided to write bash scripts for the most common developer actions to help encapsulate all our Git knowledge and best practices. The culmination of that project is a development model we’re calling Dr. Git (Develop/Release with Git) which we’re excited to share in a following blog post.


  1. Actually... a commit is a snapshot, not a diff.
    But it *can be viewed as* a diff with the previous commit by simply diffing the two snapshot.

    It's better to think it as a snapshot because you'll not understand merge commit otherwise.

    A merge commit X is a commit with multiple parents commit, say A and B.

    A -----
    |--- X
    B -----

    The merge commit is a snapshot that is different from both the A and the B commit.

    if you *show* the commit X you can see it as empty if you had no conflict resolution or you'll see the conflict resolution only, but that's git presenting you with that information doing a three-way diff, X is a snapshot :)

    hope I clarify for the other readers too ;)

    1. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Project Centers in Chennai.

      Software management seeks for decision support to identify technologies like JavaScript that meet best the goals and characteristics of a software project or improvement programme. JavaScript Training in Chennai Accessible experiences and repositories that effectively guide that technology selection are still lacking.

      Aim of technology domain analysis is to describe the class of context situations (e.g., kinds of JavaScript software projects) in which a software engineering technology JavaScript Training in Chennai can be applied successfully

  2. checkout, it's a mac client, if you haven't. I'm a fan

  3. I accidentally saw your post and it attracted me from the first few seconds, it was excellent, hope you have more successful posts. I like this post because it contains a lot of useful information to read, maybe everyone will like me.
    friv unblocked online games, friv for school for kids 2019, cá koi mini, Jogos grátis

  4. تقوم الشركة بتنظيف وتعبئة البضائع لمنعها من التلف.
    انتشر العديد من فروع الشركة في جميع أنحاء مدينة تبوك والمملكة ، مما يسهل عملية التخزين والعمل على الانتهاء بسرعة.شركة نقل عفش
    شركة نقل اثاث من الرياض الى قطر
    شركة نقل عفش من الرياض الى قطر
    شركة نقل عفش بالخبر

  5. Thanks for sharing such a nice Blog.I like it.

  6. Are you looking for the best finance dissertation help service? Visit us to avail expert assignment help at any time with a discounted price.
    accounting dissertation help

  7. It’s time to watch UFC 249 live stream online without TV cable right? This article will help you to watch Khabib vs Ferguson fight online without tv from anywhere. UFC lightweight champion UFC 249 Khabib stream free Khabib Nurmagomedov will defend former UFC interim champion Tony Ferguson at the Barclays Center in Brooklyn, New York, April 18, 2020.

  8. Hello Admin!

    Thanks for the post. It was very interesting and meaningful. I really appreciate it! Keep updating stuffs like this. If you are looking for the Advertising Agency in Chennai | Printing in Chennai , Visit Inoventic Creative Agency Today..

  9. Computer science coursework writing service students have an advantage since they are able to seek computer science research paper services and computer science case study writing services.

  10. That’s a nice article, thank you for a great article. It helped me a lot. Keep it up Must Visit Epson Printer bellen belgie