UI Developer at Sky

I build browser powered applications and tooling.

Git Bisect

Git Bisect Figure

Have you ever found a bug in code and needed to know when it was first introduced?

Perhaps, a bug was found by QA, and it is not clear where this bug was introduced. Finding where exactly the bug was introduce commonly provides us the greatest help into finding the solution.

In some cases, it might have been present for weeks, months, or even years, a traditional simple approach to this would mean that you would need to search through hundreds or thousands of commits to find when the problem was introduced.

This is the problem that git bisect was built to solve!

The git bisect command is a powerful tool that quickly checks out a commit halfway between a known good state and a known bad state and then asks you to identify the commit as either good or bad. Then it repeats until you find the exact commit where the code in question was first introduced.

This follows the Divide and Conquer approach to bug catching. Even if there are thousands of commits, git bisect allows you to approach this exercise into one that shouldn't take more than a few minutes!

Read the official documentation here: Git Bisect