git bisect

Git Bisect is a technique that utilizes Binary Search in order to efficiently determine bug-inducing commits among a batch of commits. In the event that multiple commits have been made but the code has not been built and tested in between each commit when building and testing finally take place, it can be difficult to determine which commit introduced the bug.

Rather than revert all changes, including potentially a group of commits that did not break the build, we can find the commit that introduced the bug and correct the build from this point without reverting any unnecessary changes.

This technique relies on knowing when the last stale build occurred in order to perform an optimal search. The process can be seen depicted below:

There are two ways to perform bisect.