2012-11-26 233 views
0

我知道topic-branch-7的提示有一個bug,我知道master的提示沒有bug。我想知道哪些bug是在topic-branch-7中引入的。所以我運行以下:git bisect卡住了

git checkout topic-branch-7 
# some testing to verify the bug 
git bisect start bad # start a git bisect and mark this commit as bad 
git-merge-base master topic-branch-7 
9ac8c59bb10c13d86bcdeff90cb47e25d477caad 
git checkout 9ac8c59bb10c13d86bcdeff90cb47e25d477caad 
# some testing to verify the bug is not present 
git bisect good 

什麼是扔我是當我運行git bisect好...沒有任何反應!是不是應該將提交標記爲好,在提交和提交之間找到一箇中間點,然後對該提交進行簽出?爲什麼沒有發生?

回答

0

我知道git bisect很好地工作,但我喜歡做的是通過使用分支手動。我選擇一個很好的提交併創建一個分支,稱它爲「好」。然後我開始在中間找到一個提交併進行測試。如果它是好的,那麼我在這個和主控之間的一個提交上創建一個分支,否則,我會在選擇的中間分支下的一個提交上創建一個分支。這是迭代完成的,基本上是一種二進制排序。這意味着我檢查了更少的提交,並且我比對分更精細。通常我使用gitk來檢查每個分支。另一個好處是,如果你找到了一些東西,你可以在一個單獨的分支上工作,而不會影響其餘的。例如

Master Commit 
. 
. 
. 
Test Commit <---- This one is good, so keep selecting commits above until you fail 
. 
. 
. 
Middle Commit <--- Create branch and checkout. This one is good, so go above 
. 
. 
. 
Good Commit 
+1

只是供參考,這正是'對分',除了它不創建所有額外的分支。當它發現錯誤的提交時,您可以'checkout -b'並在那裏創建一個分支。 –

+0

看着平分線我意識到這是事實。我沒有意識到我正在手動做。儘管如此,我個人更喜歡手動這樣做,因爲我經常發現有時候我需要回到分支去尋找某些東西,而當對分正在做時,我可能會干涉它。無論如何,在gitk中創建分支並刪除它們需要幾秒鐘。 –

2

我認爲你有git bisect的語法錯誤。它應該是

git-merge-base master topic-branch-7 
9ac8c59bb10c13d86bcdeff90cb47e25d477caad 
git bisect start topic-branch-7 9ac8c59bb10c13d86bcdeff90cb47e25d477caad 
#you are now at a commit somewhere in between topic-branch-7 and 9ac8c59bb10c13d86bcdeff90cb47e25d477caad 
#do testing to find out if bug is there 
git bisect good/bad 
#repeat until git tells you where the bug is introduced 
git bisect reset HEAD