tilda和插入符号在git中与HEAD有什么关系? [重复]

问题描述 投票:-1回答:1

[我看到有些人对HEAD使用插入符号和tilda符号,例如HEAD ^或HEAD〜(NUMBER VALUE),但我不太了解。

git github command-line-interface branch commit
1个回答
0
投票

来自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.
© www.soinside.com 2019 - 2024. All rights reserved.