我有以下问题:
master
的版本工作正常master
之前的最后一个标签的版本(比如last
)有一个错误- 一位同事需要为他的
上次
修订版打个补丁
好的。让我们向我们的 friend git bisect
询问修复错误的修订版:
git bisect start
git bisect bad last
git bisect good master
但这行不通:
Some good revs are not ancestor of the bad rev.
git bisect cannot work properly in this case.
Maybe you mistake good and bad revs?
有什么克服这个问题的提示吗?我是否遗漏了文档中的内容?
最佳答案
从 git 2.7 开始,您可以使用参数 --term-old 和 --term-new。
例如,您可以这样识别问题修复提交:
git bisect start --term-new=fixed --term-old=unfixed
git bisect fixed master
git bisect unfixed $some-old-sha1
在测试时,根据需要说 git bisect fixed
或 git bisect unfixed
。
旧答案,适用于 2.7 之前的 git 版本
与其暂时训练自己认为坏就是好,好就是坏,为什么不创建一些别名呢?
在 ~/.gitconfig
添加以下内容:
[alias]
bisect-fixed = bisect bad
bisect-unfixed = bisect good
您可以这样开始识别问题修复提交:
$ git bisect start
$ git bisect-fixed master
$ git bisect-unfixed $some-old-sha1
在测试时,根据需要说 git bisect-fixed
或 git bisect-unfixed
。
关于git - 我如何使用 git bisect 找到第一个 GOOD 提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15407075/