Advanced Git
Amanda Crawford-Adamo
Software and Data Engineer
A tool that uses binary search to find the commit that introduced a bug
Git Bisect Command
git bisect
Purpose
Initiate git bisect session
git bisect start
Initialize the current state as a bad state
git bisect bad
Mark the last known good state
git bisect good <commit-hash>
Marks the commit state as a bad commit
git bisect bad
Marks the commit state as a good commit
git bisect good
Checks if the commit version is good or bad by running an automated test script.
git bisect run <script_name>
Git Bisect Output Example
$ git log
b1a534f is the first bad commit
commit b1a534f89l2c3d4e5f6g7h8i9j0k1l2m3n4o5p
Author: Jane Doe <[email protected]>
Date: Thu Mar 14 14:30:00 2024 -0500
Update data transformation logic
Exits the git bisection process and return to our current HEAD
git bisect reset
Use cases
Tips
git bisect run <test-script>
Advanced Git