⚡ Advanced
How to use git bisect to find bugs
Use binary search to find which commit introduced a bug.
1. Start bisect
git bisect startBegins the bisect session.
2. Mark current commit as bad
git bisect badTells git the current commit has the bug.
3. Mark a known good commit
git bisect good v1.0.0Tells git a known good commit (a tag, hash or relative ref). Git will check out the midpoint.
4. Mark each checked-out commit
git bisect good
# or
git bisect badTest the currently checked-out commit and mark it. Git narrows down the range each time.
5. End bisect
git bisect resetEnds the bisect session and returns to your original branch.