From the docs here.
HEAD~2: 2 commits older than HEADHEAD^2: the second parent of HEAD, if HEAD was a merge, otherwise illegalHEAD@{2}: refers to the 3rd listing in the overview ofgit reflogHEAD~~: 2 commits older than HEADHEAD^^: 2 commits older than HEAD
If HEAD was a merge, then
- first parent is the branch into which we merged,
- second parent is the branch we merged.
Some Combinations and Synonyms
First Parent First Grandparent Second Parent Second Grandparent
HEAD~
HEAD^
HEAD~1 HEAD~2 HEAD^2 HEAD^2~
HEAD^1 HEAD^^ HEAD^2^