我使用git bisect查找Linux启动失败的错误提交。
目前已知的错误提交是:
commit 0f3f4fef3520fe888303886b62224bac7a837cac
Author: Darren Hart <dvhart@linux.intel.com>
Date: Mon Mar 2 09:06:39 2015 -0800
Add manifest for 2015-03-02
已知的良好提交是:
commit 857a433072364883be5e4a7e30b895360999c8ab
Merge: d6182fe 0e28b83
Author: Darren Hart <dvhart@linux.intel.com>
Date: Mon Feb 23 17:11:35 2015 -0800
Merge commit '0e28b83bcbf60b2485f55ec71ce540f9153725d4'
因此我输入:
[root@localhost linux]# git bisect start
[root@localhost linux]#
[root@localhost linux]# git bisect good 857a433072364883be5e4a7e30b895360999c8ab
[root@localhost linux]# git bisect bad 0f3f4fef3520fe888303886b62224bac7a837cac
Bisecting: a merge base must be tested
[c517d838eb7d07bbe9507871fab3931deccff539]
Linux 4.0-rc1
测试提交ID在:
[root@localhost linux]# git log
commit c517d838eb7d07bbe9507871fab3931deccff539
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun Feb 22 18:21:14 2015 -0800
Linux 4.0-rc1
领先于好的提交:
commit 857a433072364883be5e4a7e30b895360999c8ab
Date: Mon Feb 23 17:11:35 2015 -0800
我认为bisect永远不会发现糟糕的提交。
我错过了什么吗?
答案 0 :(得分:1)
我想我得到了答案,它是由git rebase引起的:
假设存在以下历史记录,并且当前分支是“主题”:
A---B---C topic
/
D---E---F---G master
从这一点来看,以下命令的结果为:
git rebase master
将是:
A'--B'--C' topic
/
D---E---F---G master
所以,B消失了。如果B是一个很好的提交,并且在rebase之后,我们发现C'是一个错误的提交,以下命令:
git bisect start
git bisect good B
git bisect bad C'
会在B之前生成测试提交,例如:E。