當使用git bisect
時,可以運行git bisect skip
來將當前提交標記爲不可構建/不可測試的,以嘗試讓Git選擇其他提交來測試。git bisect skip如何選擇下一個提交嘗試?
Git如何決定在git bisect skip
之後嘗試進行哪項承諾?實驗表明它不僅僅是一個相鄰的提交,但我無法解決這個模式。
編輯:我知道的基本git bisect
是一個二進制搜索,但我很好奇git bisect skip
,這顯然是做一些更復雜。
實驗表明它不只是選擇一個相鄰的提交;下面創建100個提交編號爲0 – 99然後開始平分它們。第一次承諾git bisect
選擇在中間,但其後每個git bisect skip
似乎或多或少隨機選擇。
$ git init
Initialized empty Git repository in .git/
$ for ((i=0; i<100; i++)); do echo $i > file; git add file; git commit -m $i >/dev/null; done # Create some dummy commits
$ git bisect start HEAD $(git rev-list --max-parents=0 HEAD) # HEAD is bad, root commit is good.
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[099e5cf2ccde625f92dc369da6cad0bdf2852ce4] 49
$ git bisect skip
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[88c8208a7c4322222124167e49f07c741af7d3d8] 60
$ git bisect skip
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[04695f2e5b2473c3ac72435c0dbfc3ba1375abda] 88
$ git bisect skip
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[1e9bf3d29589bcac2d8c467245ae8d446c195252] 40
$ git bisect skip
Bisecting: 49 revisions left to test after this (roughly 6 steps)
[9459ed79e4112d674681c8f0f921127217c7ebc6] 13
您是否閱讀過文檔?我說它使用二進制搜索。 https://git-scm.com/docs/git-bisect – crashmstr
@crashmstr你呢?子命令* skip *的確很不明確。 –
@crashmstr:我知道'git bisect'的基本用法是二分查找。但'git bisect skip'不能只是一個二進制搜索,因爲這不是一個二進制搜索_does_。是的,我已經瀏覽了文檔,甚至在問這裏之前開始嘗試查看源代碼,並且我找不到解釋如何在選擇「git bisect skip」之後進行下一次提交的任何地方。 –