by CodyJung · 13y ago · 0 comments
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...