Hands-on task
Find the breaking commit with bisect run
In /root/repo the main branch is a long linear history with identical-looking messages (step N). The script sum.sh N must print the sum of the numbers from 1 to N (bash sum.sh 10 → 55). In the very first commit it computes correctly, in HEAD it no longer does. Find the first commit where the result became wrong and write its full hash into /root/bad.txt.
The catch: several commits in the middle of the history don't run at all (a syntax error) — you can't tell whether they're good or bad. Stepping through the commits by hand is slow — let git split the history in half itself, running your check at each step.
- git bisect
- binary search
- rev-list
- check automation
- regression hunting