此问题已经在这里有了答案:
[我看到有些人对HEAD使用插入符号和tilda符号,例如HEAD ^或HEAD〜(NUMBER VALUE),但我不太了解。
来自rev-parse文档:
<rev>^, e.g. HEAD^, v1.5.1^0
A suffix ^ to a revision parameter means the first parent of that commit object. ^<n> means the <n>th
parent (i.e. <rev>^ is equivalent to <rev>^1). As a special rule, <rev>^0 means the commit itself and
is used when <rev> is the object name of a tag object that refers to a commit object.
<rev>~<n>, e.g. master~3
A suffix ~<n> to a revision parameter means the commit object that is the <n>th generation ancestor of
the named commit object, following only the first parents. I.e. <rev>~3 is equivalent to <rev>^^^ which
is equivalent to <rev>^1^1^1. See below for an illustration of the usage of this form.