Last Updated: February 25, 2016
·
872
· benkitzelman

Git Bisect: Which commit busted my tests?

Git bisect allows you to flag which commit was the last green state, and automatically iterate over each subsequent commit, running a script (i.e. your tests) until it finds the breaking commit....

i.e.

git bisect start <some-breaking-commit-sha> <last-good-commit-sha>
git bisect run <test command>

a working example using rspec:

git bisect start 120cba5 c2d0a5e
git bisect run rspec spec/mytest_spec:123