Thursday, September 19, 2013

Difference between HEAD and master

master is a reference to the end of a branch (by convention this is usually the 'trunk' of the tree, to use a SVN term, but it doesn't have to be).
HEAD is actually a special type of reference that points to another reference. It may point to master or it may not (it will point to whichever branch is currently checked out). If you know you want to be committing to themaster branch then push to this.
Here is a visual example:
alt text
On your own repository you can check where the HEAD is pointing to by running this:
$ git symbolic-ref HEAD
refs/heads/master
However, finding out where the remotes/origin/HEAD is pointing to is more tricky because it is on the remote machine.
There is a great little tutorial on git references here:

No comments:

Post a Comment