News for hackers. Stuff that matters.
Re:Why was '~' chosen to represent the home directory? by djur on Sunday November 24, 2013 @09:48PM (#6792247)
HEAD~1 and HEAD^1 are equivalent, but HEAD~n and HEAD^n aren't.

HEAD~n means "the n-parent of HEAD, always choosing the first parent." So HEAD~3 means the first parent of the first parent of the first parent of HEAD.

HEAD^n means "the nth parent of head". git commits can have multiple parents if they are merges. So HEAD^3 means the third parent of HEAD.

As a result, HEAD~1 means "the first parent of HEAD" and HEAD^1 means "the first parent of HEAD", but the 1 means two completely different things.

The gitrevisions manpage is pretty mindblowing: https://www.kernel.org/pub/software/scm/git/docs/gitrevision...

There are no comments on this comment yet.