git bisect没有响应命令

jas*_*328 4 git git-bisect

我在一个单独的分支上redesign-test-fixes,我跑了git bisect start.在那之后,我测试我的bug并运行git bisect bad.终端打印无输出.然后我跑了git bisect good.同样的事情,终端上没有打印输出.就像bisect一开始没有运行一样.通常我希望终端输出有关剩余步数的信息.怎么了?怎么解决这个问题?我是否处于一种不允许我运行bisect的git状态.

git状态响应:

On branch redesign-test-fixes
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)

但是,如果我运行git bisect startgit status响应:

On branch redesign-test-fixes
You are currently bisecting, started from branch 'redesign-test-fixes'.
  (use "git bisect reset" to get back to the original branch)

nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)

Tim*_*sen 8

您使用git bisect不当.键入后git bisect start,您需要提供一系列提交以git bisect供使用.此范围由"良好"提交定义,其中您确定不会出现错误,然后是"错误"提交,您认为该错误肯定存在.因此,您的使用应该从这样开始:

git bisect start
git bisect good <SHA-1 of good commit>
git bisect bad  <SHA-1 of bad commit>
Run Code Online (Sandbox Code Playgroud)

假设你在bad和good之间有20次提交,那么你应该看到输出看起来像这样:

Bisecting: 10 revisions left to test after this (roughly 4 steps)
Run Code Online (Sandbox Code Playgroud)

剩下10个修订版的原因是因为Git已经检查了你所选范围内的中间提交,并且它知道最多需要检查10次提交才能找到引入错误的提交.

接下来,您需要在此中间提交中检查您的应用程序,并确定是否存在该错误.如果您没有找到该错误,请键入:

git bisect good
Run Code Online (Sandbox Code Playgroud)

如果你确实看到了这个bug,那么输入:

git bisect bad
Run Code Online (Sandbox Code Playgroud)

这将再次显示如下输出:

Bisecting: 5 revisions left to test after this (roughly 2 steps)
Run Code Online (Sandbox Code Playgroud)

在没有明确告诉你的情况下,Git再次检查了新范围的中间提交.

你将继续这个打字过程git bisect good/bad,当没有什么可以分开时,Git会告诉你第一个错误的提交:

a8h39dk32... is the first bad commit
Run Code Online (Sandbox Code Playgroud)

进一步阅读:

这是一个很棒的教程的链接,涵盖了完整的用法git bisect.我发现即使官方的Git文档也不完全彻底.

  • "承诺的中间点"甚至意味着什么?即使第一次提交是在几年前完成的,Git选择你最近的提交和第一次提交之间的中间点是否真的是一个好的设计?是的,您需要提供_range_(初始好的和坏的提交)提交以使用`git bisect`. (2认同)