garysimpson.dev
Mobile development with swift and flutter

Finding Defects With Git Bisect

October 24, 2024 at 6:30PM

Ended up needing to find where a defect was introduced. Tunrs out there is a command for that. git bisect to the rescue!

Bisect Steps

  1. Start the Process.
git bisect start
  1. Mark current commit as bad (error is present):
git bisect bad
  1. Mark last known good commit (error NOT present):
git bisect good <commit_hash>
  1. 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
    
    1. Repeat step 4 until Git identifies the problematic commit.
    1. End the bisect process:
    git bisect reset
    

    Truns out the rabbit hole goes super deep based on some documentation I found online.



    Happy Coding ;-)