我怎么能用git bisect来找到第一个好的提交? [英] How could I use git bisect to find the first GOOD commit?
问题描述
我有以下问题:
$ b
-
master 版本正常 -
master
(例如last
)之前的最后一个标记的版本一个bug - 一位同事需要为他的
last
修订版修正某个bug
好的。让我们问问我们的朋友 git bisect
来修正修正错误的版本:
git bisect start
git bisect bad last
git bisect good master
但是这是行不通的:
一些好的转速不是坏的转速的祖先。
git bisect不能工作正确地在这种情况下。
也许你错误的好转和坏转?
任何提示来解决这个问题?我错过了文档中的某些东西吗?
从git 2.7开始,您可以使用参数--term-old和 - 例如,您可以确定问题修复提交:
> git bisect start --term-new = fixed --term-old =未固定
git bisect固定主
git bisect未定义$ some-old-sha1
在测试时,比如说 git bisect fixed
或 git bisect不固定
。
旧答案,对于2.7之前版本的git
而不是暂时训练自己认为坏的意味着好的和好的意味着糟糕,为什么不创建一些别名?
〜/ .gitconfig
添加以下内容:
[别名]
bisect-fixed = bisect bad
bisect -infixed = bisect good
您可以开始从而确定问题修复提交:
$ git bisect start
$ git bisect-fixed master
$ git bisect-unfixed $ some -old-sha1
在测试时,比如 git bisect-fixed
或
git bisect-unfixed
。
I have the following problem:
- the version at
master
works fine - the version of the last tag before
master
(saylast
) has a bug - a colleague needs a patch for his
last
revision for that certain bug
Okay. Let's ask our friend git bisect
for the revision that fixed the bug:
git bisect start
git bisect bad last
git bisect good master
But that's not going to work:
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?
Any hints to overcome this? Did I miss something in the docs?
As of git 2.7, you can use the arguments --term-old and --term-new.
For instance, you can identify a problem-fixing commit thus:
git bisect start --term-new=fixed --term-old=unfixed
git bisect fixed master
git bisect unfixed $some-old-sha1
As you test, say git bisect fixed
or git bisect unfixed
as appropriate.
Old answer, for versions of git prior to 2.7
Instead of temporarily training yourself to think that bad means good and good means bad, why not create some aliases?
In ~/.gitconfig
add the following:
[alias]
bisect-fixed = bisect bad
bisect-unfixed = bisect good
You can start identifying a problem-fixing commit thus:
$ git bisect start
$ git bisect-fixed master
$ git bisect-unfixed $some-old-sha1
As you test, say git bisect-fixed
or git bisect-unfixed
as appropriate.
这篇关于我怎么能用git bisect来找到第一个好的提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!