Finding Defects With Git Bisect
October 24, 2024 at 6:30PMEnded up needing to find where a defect was introduced. Tunrs out there is a command for that. git bisect
to the rescue!
Bisect Steps
- Start the Process.
git bisect start
- Mark current commit as bad (error is present):
git bisect bad
- Mark last known good commit (error NOT present):
git bisect good <commit_hash>
- Git will check out a commit halfway between the good and bad commits. Test if the error is present:
- If the commit has the error, mark it as bad:
git bisect bad
- If the commit does not have the error, mark it as good:
git bisect good
- Repeat step 4 until Git identifies the problematic commit.
- End the bisect process:
git bisect reset
Truns out the rabbit hole goes super deep based on some documentation I found online.
Happy Coding ;-)