使用 时git bisect
,可以运行git bisect skip
以将当前提交标记为不可构建/不可测试的提交,以尝试让 Git 选择其他提交进行测试。
Git 如何决定在 a 之后尝试哪个提交git bisect skip
?实验表明它不仅仅是一个相邻的提交,但我无法计算出这种模式。
编辑:我知道基本git bisect
是二进制搜索,但我很好奇git bisect skip
,这显然是在做一些更复杂的事情。
实验表明它不仅仅是选择一个相邻的提交;下面创建了 100 个编号为 0-99 的提交,然后开始将它们一分为二。第一个提交git bisect
选择位于中间,但之后的每个提交git bisect skip
似乎或多或少是随机选择的。
$ git init
Initialized empty Git repository in .git/
$ for (( i=0; i<100; i++ )); do echo $i > file; git add file; git commit -m $i >/dev/null; done # Create some dummy commits
$ git bisect start HEAD $(git rev-list --max-parents=0 HEAD) # HEAD is bad, root commit is good.
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[099e5cf2ccde625f92dc369da6cad0bdf2852ce4] 49
$ git bisect skip
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[88c8208a7c4322222124167e49f07c741af7d3d8] 60
$ git bisect skip
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[04695f2e5b2473c3ac72435c0dbfc3ba1375abda] 88
$ git bisect skip
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[1e9bf3d29589bcac2d8c467245ae8d446c195252] 40
$ git bisect skip
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[9459ed79e4112d674681c8f0f921127217c7ebc6] 13