gpt4 book ai didi

git - 什么是 git 边界提交

转载 作者:IT王子 更新时间:2023-10-29 00:49:14 25 4
gpt4 key购买 nike

git log command有一个 --boundary 选项,它会导致程序

Output excluded boundary commits.

但是什么是边界提交?我什么时候可以将它们包含在输出中?

最佳答案

边界提交是限制修订范围但不属于该范围的提交。例如,修订范围 HEAD~3..HEAD 包含 3 个提交(HEAD~2HEAD~1HEAD ),提交 HEAD~3 作为它的边界提交。

更正式地说,git 通过从指定的提交开始并通过父链接获取其他提交来处理修订范围。它在不符合选择标准的提交处停止(因此应该被排除)——那些是边界提交。

插图:

$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in ~/playground/git/test/.git/
$ touch a
$ git add a
$ for i in {1..5}; do echo $i >> a; git commit -m "Commit #$i" a; done
[master (root-commit) bf958f1] Commit #1
1 file changed, 1 insertion(+)
create mode 100644 a
[master 3721a8b] Commit #2
1 file changed, 1 insertion(+)
[master d69efcc] Commit #3
1 file changed, 1 insertion(+)
[master 72cd21d] Commit #4
1 file changed, 1 insertion(+)
[master 17ae9c3] Commit #5
1 file changed, 1 insertion(+)
$ git log --oneline
17ae9c3 Commit #5
72cd21d Commit #4
d69efcc Commit #3
3721a8b Commit #2
bf958f1 Commit #1
$ git log --oneline HEAD~3..
17ae9c3 Commit #5
72cd21d Commit #4
d69efcc Commit #3
$ git log --oneline HEAD~3.. --boundary
17ae9c3 Commit #5
72cd21d Commit #4
d69efcc Commit #3
- 3721a8b Commit #2 <-- This is the boundary commit HEAD~3 that would
not be included in the output had the '--boundary'
option NOT been provided

关于git - 什么是 git 边界提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42437590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com