git bisect: Use binary search to find which commit introduced a bug. git bisect finds the commit that introduced a bug by binary search. You mark one commit as good and one as bad, and Git checks out a commit halfway between them. You test it and mark it good or bad, and Git halves the range again.
Even with a thousand commits in between, it takes about ten steps to find the culprit. That is often far quicker than reading through changes and guessing.
What should you keep in mind with git bisect?
If you can write a script that tests for the bug and exits with an error code when it is present, git bisect run ./test.sh does the whole search automatically. Bisect works best when every commit builds and runs, which is one more reason to keep commits small and complete. When you are done, git bisect reset returns you to where you started.
Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback