git bisect#

Given that HEAD is a bad commit and v2.6.13-rc2 is good, start the bisect process:

git bisect start
git bisect bad
git bisect good v2.6.13-rc2

Next, choose either one of:

git bisect good
git bisect bad

When done:

git bisect reset

Commits That Cannot be Tested#

Git’s bisect is one of the reasons, why you should commit working code only. If you have commits that cannot be tested, you may skip them with

git bisect skip


Create a script that runs your tests and returns an error code that git bisect can use: 0 for success or 1..127 (inclusive) for errors, e.g.

cat <<EOF > /tmp/
if pytest; then
    exit 0
    exit 1

chmod +x /tmp/

Use it for bisect

git bisect run /tmp/

Further Reading#