Interview Prep/Git & GitHub/Commits, branches and tags

How do you find which commit introduced a bug?

IntermediateConceptCommits, branches and tags
Answer

Use git bisect, which binary-searches history. Mark one bad and one good commit, then test each checkout or let a script decide with its exit code (0 good, 1-124 bad, 125 skip).

git bisect start
git bisect bad HEAD
git bisect good v1.3.0
git bisect run ./test.sh
git bisect reset
All Git & GitHub questions Roadmap: Git & GitHub

More on Commits, branches and tags