HEAD~4^2 meaning
X~n
means: The n
th ancestor of X
.
X^
means: The parent of X
. This is equivalent to X~1
.
If X
has more than one parent, one needs to distinguish between them when using the ^
notation. So X^1
would be the first parent, X^2
would be the second parent, and so on. X^
is equivalent to X^1
(and also equivalent to X~1
).
In your example, starting from commit 9ec05ca
, which is HEAD
:
db7e87a
isHEAD~1
(or alternativelyHEAD^
).796ddb0
isHEAD~2
(or alternativelyHEAD^^
).1a56a81
isHEAD~4
(or alternativelyHEAD^^^^
, but nobody would use that).e014d91
, being the first parent of1a56a81
, isHEAD~5
, orHEAD~4^
, orHEAD~4^1
.f69811c
, being the second parent of1a56a81
, isHEAD~4^2
.
Reference
https://git-scm.com/docs/gitrevisions