我知道git reset --hard
通常会做什么,但我看到它在git help bisect
示例中使用,但我不明白效果:
Avoiding testing a commit
If, in the middle of a bisect session, you know that the suggested revision is not a good
one to test (e.g. it fails to build and you know that the failure does not have anything
to do with the bug you are chasing), you can manually select a nearby commit and test that one
instead.
For example:
$ git bisect good/bad # previous round was good or bad.
Bisecting: 337 revisions left to test after this (roughly 9 steps)
$ git bisect visualize # oops, that is uninteresting.
$ git reset --hard HEAD~3 # try 3 revisions before what
# was suggested
Then compile and test the chosen revision, and afterwards
mark the revision as good or bad in the usual manner.
该示例的最后一行有什么作用?起初我认为这可能是一个错字,这个例子的意思是说git *bisect* reset --hard HEAD~3
,但这对我来说没有任何意义。
FWIW,我从未使用过或见过gitk
,git bisect visualize
似乎与该命令有关。在我理解这个例子之前,这是我必须学习的东西吗?
更新:根据回复,我推断git bisect start
创建一个新分支并使用它?无论如何,要理解这一行,我是否需要了解git bisect
比文档中所述更多的实现git bisect
;我搜索了“分支”一词,但找不到任何说明git bisect
命令创建分支的内容。