我怎样才能回去测试什么东西坏了? [英] How can I go back and test where something broke?
问题描述
我想回到之前的提交并运行我的程序,直到我发现某些内容在没有删除或影响我的提交的情况下崩溃。一旦找到最后一次提交的地方,我可以看到什么改变了回到当前的提交并修复它。
我该怎么做? 正确的命令: git bisect
。它将执行二进制搜索,并允许您将每个测试提交标记为 good
或 bad
开始平分过程:
git bisect start HEAD< last good commit>
然后构建源代码,运行它,检查错误并最终标记它:
git bisect good#或:
git bisect bad
如果您无法测试提交(构建损坏等),请使用 git bisect skip
跳过它。
直到找到第一个坏提交为止。要回到原始提交,请运行 git bisect reset
。
I want to go back to prior commits and run my program until I found out where something broke without deleting or affecting my commits. Once I find the last commit where it was working I can see what changed the go back to the current commit and fix it.
How would I do this?
Git provides just the right command for that: git bisect
. It will perform a binary search and allows you to mark each tested commit either good
or bad
Start the bisect procedure with:
git bisect start HEAD <last good commit>
Then build your source, run it, check for errors, and finally mark it:
git bisect good # or:
git bisect bad
If you cannot test a commit (build broken, etc.), skip it with git bisect skip
.
Do that until you found the first bad commit. To get back to your original commit, run git bisect reset
.
这篇关于我怎样才能回去测试什么东西坏了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!