Debugging with Git

Nesha Zoric on June 18, 2018

When you are working on a huge project, you may discover bugs in the code that prevent you from proceeding any further in your development. How t... [Read Full]
markdown guide

I don't understand: how does git bisect check if a commit is good or bad? Does have an integration with unit tests?


There's no integration. It would be up to you to evaluate if a commit is good or bad by either running a test, starting the app locally, or playing with it on repl/console. Git bisect reduces the number of commits you would have to go through with binary search.


You can also use git bisect run to have Git run your tests - that way if your test suite takes a while, you can leave and make yourself a sandwich or something. When you get back, Git will have done all the work for you!


Could you please show a debugging session where this helps find the bug? As is I don't think I get the workflow with these tools


I sometimes wish that there was a way to do this bisection search faster. It's really a painful process, yet sometimes it cannot be avoided.


I haven't used it in a while, but I wrote a tool called git-pisect that leverages multiple cores to converge on the offending commit:

Let me know if it works for you!


There are two similar commit hashes in the bisect example - 95d69a1, so it's not clear which one will get tagged as good.

code of conduct - report abuse