HEAD~4^2 的意思
HEAD~4^2 meaning
在涵盖相对提交引用的 Udacity 课程中,它说:
^ indicates the parent commit, ~ indicates the first parent commit
The main difference between the ^ and the ~ is when a commit is
created from a merge. A merge commit has two parents. With a merge
commit, the ^ reference is used to indicate the first parent of the
commit while ^2 indicates the second parent. The first parent is the
branch you were on when you ran git merge while the second parent is
the branch that was merged in.
根据课程,根据 git log --graph --oneline
的以下输出,使用 SHA f69811c
的提交是 HEAD~4^2
相对于(最顶层,带有头指针)提交 9ec05ca
.
所以 HEAD~4 本身表示第一个父级,而 ^2 表示它也是第二个父级?这些东西不是相互矛盾的吗?任何澄清表示赞赏。
X~n
表示:X
的第n
个祖先。
X^
表示:X
的parent。这相当于 X~1
.
如果X
有多个parent,在使用^
符号时需要区分它们。所以 X^1
将是第一个 parent,X^2
将是第二个 parent,依此类推。 X^
等同于 X^1
(也等同于 X~1
)。
在您的示例中,从提交 9ec05ca
开始,即 HEAD
:
db7e87a
是 HEAD~1
(或者 HEAD^
)。
796ddb0
是 HEAD~2
(或者 HEAD^^
)。
1a56a81
是 HEAD~4
(或者 HEAD^^^^
,但没有人会使用它)。
e014d91
,作为 1a56a81
的 第一个 parent,是 HEAD~5
,或 HEAD~4^
,或 HEAD~4<b>^1</b>
.
f69811c
,作为 1a56a81
的 第二个 parent,是 HEAD~4<b> ^2</b>
.
参考
并非完全错误,但有点太短了:因为“~”运算符正在执行深度搜索(第 n 个祖先,实际上对应于单个分支上的第 n 个最后提交),它的参数不能'如果它们很多,请指定 parent。因此,它假定它应该始终遵循其中的第一个。这与我们讨论 parent 顺序的 有关。
在涵盖相对提交引用的 Udacity 课程中,它说:
^ indicates the parent commit, ~ indicates the first parent commit
The main difference between the ^ and the ~ is when a commit is created from a merge. A merge commit has two parents. With a merge commit, the ^ reference is used to indicate the first parent of the commit while ^2 indicates the second parent. The first parent is the branch you were on when you ran git merge while the second parent is the branch that was merged in.
根据课程,根据 git log --graph --oneline
的以下输出,使用 SHA f69811c
的提交是 HEAD~4^2
相对于(最顶层,带有头指针)提交 9ec05ca
.
所以 HEAD~4 本身表示第一个父级,而 ^2 表示它也是第二个父级?这些东西不是相互矛盾的吗?任何澄清表示赞赏。
X~n
表示:X
的第n
个祖先。
X^
表示:X
的parent。这相当于 X~1
.
如果X
有多个parent,在使用^
符号时需要区分它们。所以 X^1
将是第一个 parent,X^2
将是第二个 parent,依此类推。 X^
等同于 X^1
(也等同于 X~1
)。
在您的示例中,从提交 9ec05ca
开始,即 HEAD
:
db7e87a
是HEAD~1
(或者HEAD^
)。796ddb0
是HEAD~2
(或者HEAD^^
)。1a56a81
是HEAD~4
(或者HEAD^^^^
,但没有人会使用它)。e014d91
,作为1a56a81
的 第一个 parent,是HEAD~5
,或HEAD~4^
,或HEAD~4<b>^1</b>
.f69811c
,作为1a56a81
的 第二个 parent,是HEAD~4<b> ^2</b>
.
参考
并非完全错误,但有点太短了:因为“~”运算符正在执行深度搜索(第 n 个祖先,实际上对应于单个分支上的第 n 个最后提交),它的参数不能'如果它们很多,请指定 parent。因此,它假定它应该始终遵循其中的第一个。这与我们讨论 parent 顺序的