如何恢复git bisect

8
假设我正在进行 Git Bisect,在运行 git bisect bad 命令后,我的 Git Bisect 被中断,如下所示:
$ git bisect bad
Bisecting: 0 revisions left to test after this (roughly 1 step)
error: Your local changes to the following files would be overwritten by checkout:
    app/app.iml
Please commit your changes or stash them before you switch branches.
Aborting

我可以通过运行以下命令来轻松删除此文件:

git checkout -- app/app.iml

这将使我的git状态再次清洁..但我不确定之后该如何操作(即让git bisect继续二分).. 我相信我之前进行了git bisect bad,但它跳过了一步或者做了我意想不到的事情。我只是想恢复我的git bisect操作..应该如何操作?


1
我猜测 git bisect bad 没有生效,所以你需要再次运行它。如果你不确定,可以查看 git bisect log(https://git-scm.com/docs/git-bisect#_bisect_log_and_bisect_replay)。 - zigarn
2个回答

11

git bisect goodgit bisect bad所做的最后一件事情是在下一个提交上运行git checkout进行测试,而正是这个git checkout失败了。

git bisect尝试使用git checkout的修订版本存储在特殊引用BISECT_EXPECTED_REV中。您可以清理任何失败的内容并运行git checkout BISECT_EXPECTED_REV来检出它。此时,您需要恢复任何自动化或手动测试。


2

你可以始终使用git bisect log命令,该命令将输出到目前为止完成的所有二分查找操作。

如果你保存了这个输出结果,稍后可以使用git bisect replay <logfile>命令重新播放它。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接