Rick DeNatale wrote:

>> I've spotted one minor deficiency in the article so far (there's no
>> such thing as the "HEAD of the current branch" as Git maintains just
>> one HEAD ref)
> Not exactly.
> .git/HEAD contains an indirect reference to a git ref so, if I'm
> working on the branch foo
> $cat .git/HEAD
> ref: refs/heads/master
> $ls .git/refs/heads
> foo master
> so there's a heads ref for each branch known to my 'client' machine
> $cat .git/refs/master
> 0407dee585688b08aecdd27ff33bcea81d8422a5
> $cat .git/refs/foo
> 249599f642b50ffc2dd0fcd1f4716b8fc89e5633
> These are the sha hashes of the last commit on each of the branches.

This is all true, of course, but I meant point out a different issue.
Actually, I was talking about this phrase:
"... If I pass the -f option to checkout, it acts the same in this
case to reset --hard, except that checkout only ever changes the
working tree, whereas reset --hard changes the current branch's HEAD
to reference the specified version of the tree.",
and that's why I used the word "HEAD", and not "head".

The idea is that the "HEAD" is a distinguished reference, which is
used to point to the commit object on which the work tree is based,
and it has no inherent relation to the notion of the "current branch".
I suspect the author really meant an informal "head" there, or the
branch's tip commit, but in its present form that phrase can make a
beginner into thinking each branch has some sort of reference named
"HEAD" attached to it, which is wrong.

I also suspect the author came from Subversion (as I did) where the
phrase "current branch's HEAD" has perfect sense. ;-)

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to