我有一个使用“主干”流的存储库,其中功能分支合并并创建合并提交,并且正在使用 bisect 尝试查找何时引入问题。问题识别过程涉及与已知良好提交的结果进行比较,因此我使用git bisect --first-parent
(2.29 中的新功能)跳过不在“主干”分支中的提交(识别导致问题的合并提交对我来说就足够了)。
但是,git bisect --first-parent
正在选择没有我作为祖先的第一个好的提交的提交,我不确定这是怎么可能的。
在下面的示例中,提交2
是好4
是坏。
a
/ \
1-2-3-4
如果没有--first-parent
,我希望功能分支提交a
包含在二等分中,但是如果使用--first-parent
,我希望它跳过该提交,并且只测试合并提交,3
.
我已经在一个迷你存储库上对此进行了测试,它的行为符合我的预期,但是我更大、更复杂的存储库并没有跳过没有first-good
作为祖先的提交,我很难理解为什么.
我的命令是
# both "first-good" and "first-bad" are tags on the "trunk" branch
git bisect start --first-parent
git merge-base --is-ancestor first-good first-bad # returns TRUE
git merge-base first-good first-bad # returns first-good
git checkout first-bad
git bisect bad
git checkout first-good
git bisect good
git merge-base --is-ancestor first-good HEAD # returns FALSE - why/how?
git merge-base first-good HEAD # returns some other commit - why/how?