Binary search to find the commit that introduced a bug
- 97fb4a6 (HEAD -> git-bisect-test) (4 minutes ago) | Some change 123
(...)
- 38620f0 (5 hours ago) | Some change 2
- fbaf4f6 (5 hours ago) | Some change 1
- 4a831ee (1 week ago) | Some feature 2
- 09cb5c8 (1 week ago) | Some feature 1
- 6c39822 (2 weeks ago) | [maven-release-plugin] prepare for next development iteration
- 9a0257e (tag: app-1.0.0) (2 weeks ago) | [maven-release-plugin] prepare release app-1.0.0
Commit 97fb4a6 is broken (tests failed). We want to find out which commit introduced a bug.
- Start bisect
git bisect start
(git-bisect-test|BISECTING)
-
We know that current commit is BAD
git bisect bad
-
We know that last release was OK
git bisect good app-1.0.0
Bisecting: 103 revisions left to test after this (roughly 7 steps)[fbaf4f68f4ebeee50c84e38d228c59fa7d8e9ab3] some feature change
- Run tests/scripts etc., if failed
git bisect bad
, if okgit bisect good
Bisecting: 51 revisions left to test after this (roughly 6 steps)
(...)
- Result
97fb4a69ecca4ddc2c9837b7491c71d1c3a3797a is the first bad commit