git bisect
Use binary search to quickly find the commit that introduced a bug
Syntax
git bisect <subcommand> [<options>]
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
start |
|
Common | |
bad [<rev>] |
|
Common | |
good [<rev>] |
|
Common | |
reset |
, | |
Common |
run <script> |
, | |
Common |
Examples
: bug, v1.0.0
git bisect start git bisect bad HEAD git bisect good v1.0.0
Bisecting: 12 revisions left to test
git bisect good
git bisect bad
,
git bisect reset
git bisect run npm test
Tips
- 100 7 (log2(100)≈7)
- bisect run bug
- git show
- git bisect reset