-1

我的问题涉及 git bisect 何时发现第一个错误提交

$ git bisect good
2060c40f6c3d3c057f9fdab31643599da375296b is the first bad commit  ❌
commit 2060c40f6c3d3c057f9fdab31643599da375296b
Author: ....
Date:   Tue Feb 16 11:15:52 2021 -0800

现在,理想情况下,我想继续并确定LAST GOOD COMMIT

我的问题是:

(注意:我如何手动找到最后一个好的提交的步骤,请遵循。这并不难,只是乏味)。

git 完全知道2060c40f6c3d3c057f9fdab31643599da375296b前面有8993de6cc8bac3d5867e6b84fe30c52c9e604737(见下文)。有没有办法在 git/git bisect识别第一个错误提交时快速获取该信息,而无需手动搜索提交历史记录?

我想看的

$ git bisect good
2060c40f6c3d3c057f9fdab31643599da375296b is the first bad commit
8993de6cc8bac3d5867e6b84fe30c52c9e604737 is the last good commit  MOCKUP

我如何找到最后一个好的提交的详细信息:

git checkout <mybranch-before-git-bisect>然后

git log

我一直回到顶部,现在可以查找第一个错误提交

/2060c40f6c3d3c057f9fdab31643599da375296b

这让我

commit 2060c40f6c3d3c057f9fdab31643599da375296b (037.secure.010.varsettings2jsontag, refs/bisect/bad) 
❌ 1ST BAD COMMIT
Author: ...
Date:   Tue Feb 16 11:15:52 2021 -0800

    037.secure.010.varsettings2jsontag fixed, added cssremovefilter ing for tests

commit 8993de6cc8bac3d5867e6b84fe30c52c9e604737 (refs/bisect/good-8993de6cc8bac3d5867e6b84fe30c52c9e604737)  
✅ LAST GOOD COMMIT
Author: ...
Date:   Mon Feb 15 22:29:42 2021 -0800

什么不起作用(但感觉应该)

  • git log在 bisect 发现第一个错误提交没用之后
$ git log
commit 27f31fc8be6c6ef0ae493272364397c7b27f2550 (HEAD -> 059.ora.010.batch_usergroup_hang)
Author: ...
Date:   Tue Feb 9 21:36:43 2021 -0800 1️⃣

    "just a backup, use it sparingly on main codelines"

commit cdd80520ffd025a98629f3aa43a817ee4ebe96ab
Author: ...
Date:   Tue Jan 26 15:41:52 2021 -0800 2️⃣

    wip on generated/urls.py - not much so far

commit b7d05cf0df9a43b8ab3f36a81e618c8130905d87
Author: ...
Date:   Sun Nov 15 22:17:12 2020 -0800 3️⃣

即如果我git log在 git bisect 找到第一个错误提交后,我会在 1️⃣ 2️⃣ 3️⃣ 处及时获得 3 个条目。许多提交丢失了,所以这是没用的。

我在 git 版本 2.23.0

4

1 回答 1

1

最后一个好的提交只是第一个坏提交的父级,您可以通过将 a 附加^到给定的提交哈希来找到它:

$ git show 2060c40f6c^ | head -1
于 2021-02-18T23:20:28.263 回答