Finding a bad commit with git-bisect

When working on a project last year, I was introduced to this handy feature in Git – git bisect.  According to, it allows you to:

Use binary search to find the commit that introduced a bug

It is pretty straightforward to use it:

  1. Initiate a bisect session
    $ git bisect start
  2. Specify a good commit
    $ git bisect good d89ec
  3. Specify a bad commit
    $ git bisect bad 96cac
  4. At this point, Git will output something like this:
    Bisecting: 6 revisions left to test after this (roughly 3 steps)
  5. Test your site, if it looks good, type:
    $ git bisect good


    $ git bisect good
  6. Now git will output something like:Bisecting: 3 revisions left to test after this (roughly 2 steps)
  7. Repeat Step 5 until there’s git says something like this:d89ecffb672c142cadbbaeef5e31597aac6ecf06 is the first bad commit


Leave a Reply