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
Automation#
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/bisect-run.sh
#!/bin/bash
if pytest; then
exit 0
else
exit 1
fi
EOF
chmod +x /tmp/bisect-run.sh
Use it for bisect
git bisect run /tmp/bisect-run.sh
Further Reading#
OpenWrt on Linksys EA7300 V2
TIL: Dockerfile Heredocs