Resources for understanding git

by Theo22. July 2012 17:44

To be good at using git, you need not only to learn it but you need to understand it. Git's working seems like magic until you understand why it does what it does.

This is the three best resources i've found for understanding how git works. I've you use git and don't know these, i suggest you take a look. 

The Git Parable - (blogpost:
Tom Preston-Werner has written a great blogpost describing how you might come to design a VCS like git. Now this is a made up story, but provides insights into the reasoning on the design  for git. 

Git for Ages 5 and Up - (presentation:
As you probably already know, git works internally with its commits in a graph-structure. This presentation explains and runs through examples in git while illustrating what git does using Tinker Toys. This may sound weird but is actually a great way to understand git's internal structure.

Think Like A Git - (website:
A site that more directly describes git for "Advances beginners".

Ignoring already committed files

by Theo18. October 2011 09:24

Ever added a file to .gitignore and found that it still kept being added to the index? Well this is because git will only ignore files not currently under source control, or only files that its not already tracking.

To fix this, tell git to stop tracking the file:

git rm –cached filename

This is usable for when you discover a file thats already been commited which should be ignored.

source: stackoverflow

Quick-quick guide to the VI-editior in Git bash

by Theo20. March 2010 01:10

Two modes: command (the initial) and type


‘i’goes to Type-mode (where you can type like a normal notepad document)
‘esc’Goes to Command-mode

Quitting: (from command-mode)

‘:wq’ + enterQuit and save
‘:q!’ + enterQuit and don’t save

Solution to slow Git bash when logged in as a domain user

by Theo19. March 2010 12:44

Today i found that my newly installed git on my laptop at work was working pretty slow. 0.5 ~ 1sec delay on loading the git bash, and on every command. I logged in as a local user on the computer and the delay was gone.

Searching the internet a bit, i found that git uses the default home, on my account set to be a network account. This ment that git would look in this directory all the time, causing the delay.

To fix this i created a local user environment variable, overriding the default one, and setting it to %USERPROFILE% which points at c:\users\[username].


This makes git look the right place for the git.config.

Next is that when you click the git bash shortcut, i opened on my default homedrive, which was a network connection.  Looking at the properties for the shortcut it looks like this:

Git Start In

Changing the "Start in" to c:\user\[user], or any other place made the shortcut open much faster for me.

Now my git bash is back and fast again :)

Git - Fast distributed code versioning

by Theo24. September 2009 23:16

In case you haven’t noticed, there's a new code versioning system around, that's gaining popularity fast.

Meet Git.. :)
(click to open git’s homepage)

Now i am just starting to lean git, but as far as I've understood, here's are some of the main points:

  • Distributed model, as opposed to the normal centralized model from CVS and Subversion – this means that you don’t see your versioning as working from one place all the time. You have your own repository that you commit to, and then you pull or push your changes to or from others from that.
  • Your repository contains the whole history of git (the whole thing) locally  – that both means that diff’s and history lookups are dead fast – and also that you have images of everything lying on every person on the projects computer.
  • Git tracks content not files – this means that there's better code-tracking even across files, and also makes it easier for it to merge content.
  • Open source and made by Linus Thorvalds and his team – is currently used for versioning the Linux kernel.
  • Most open source projects around are currently converting from subversion to it, because the distributed model suits open source project much better – also there's free hosting for open source projects on Github.

On Git’s homepage you can find information, tutorials, and also a nice video of Linus expressing his view on code versioning.

Now git is developed on linux, but there's a port for Windows called msysGit and extensions which add a nicer gui and visual studio support on sourceforge (GitExtensions)

Now it seems that git is stronger and faster than Subversion which we normally use on our projects (or Team Foundation), but there's a slight learning hump to start with, as most people are used to a centralized versioning model, as CVS, SVN and Team Foundation (although you can of cause use a central repository with git also). Once people get more acquainted with git I'm sure it will gain even more popularity.

That's all for now on Git - once I've played around with it some more I'll write another post about my experiences.

Theo Andersen

Hi, you've reached my blog on software development.

I use this blog mostly for my own purpose of remembering stuff, so i only put things here once in a while when i get the time.

My current focus is on TDD, unit testing, object oriented code and IOS development.