On 2008.12.29 16:38:30 -0000, Zorba wrote: > so a detached HEAD is just a HEAD that is not sitting on a tip ? > > i.e. if I do $ git reset --hard HEAD^ > > ...pointing HEAD to the previous committ > > this is a detached HEAD No. At least that won't turn an "attached" HEAD into a detached HEAD. Attached HEAD: HEAD is a symbolic ref to another ref. Detached HEAD: HEAD is a non-symbolic ref to a commit. So you can have: HEAD -> refs/heads/master -> commitA --> attached HEAD Or: HEAD -> commitA --> detached HEAD Note how the commit object is the same in both cases. What you "git reset [--hard] HEAD^" does, depends on the kind of HEAD you have. "git reset HEAD^" will (conceptually, implementation might differ): Resolve HEAD^ to find a commit. and Resolve HEAD until it finds a non-symbolic ref, and update that ref to reference the commit it found. Looking at the cases from above: Attached case: HEAD -> refs/heads/master -> commitA Resolve HEAD^: HEAD^ ==> refs/heads/master^ ==> commitA^ ==> commitA_parent Find non-symbolic ref: HEAD (symbolic) ==> refs/heads/master (non-symbolic) So refs/heads/master gets updated to reference commitA_parent. Now the detached case: HEAD -> commitA Resolve HEAD^: HEAD^ ==> commitA^ ==> commitA_parent Find non-symbolic ref: HEAD (non-symbolic) So HEAD gets updated to reference commitA_parent. In other words, HEAD is what tells git what you have checked out. And that's either a branch head (attached HEAD, symbolic ref) or a commit (detached HEAD, non-symbolic ref). In the symbolic ref case, operations like "commit" or "reset" work on the branch you have checked out (found through the symbolic ref), in the non-symbolic ref case (detached HEAD), those operations work on HEAD itself. Björn -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html