Warm-up · from “Reflog, fsck and disaster recovery”
Why is reflog local?
Why is reflog local?
No notes: write what you remember, then check. Recalling before reading is what makes it stick.
The problem
A test used to pass, but after twenty commits it fails. How can you find the first bad commit without reading every change?
After this lesson you can
Use bisect to isolate a regression.
Interpret blame as evidence.
Inspect a suspected commit.
Key terms
Full glossarySay what each term means, then open it to check.
Commit · from lesson 7
Object identifying a root tree, parent(s), metadata and message.
Visual mental model
- Known good A
- midpoint test
- narrower range
- first bad candidate
Build the mental model
Git bisect searches between a known good and bad commit by checking intermediate commits and asking you to classify them. In a simple linear history with a stable reproducible failure, binary search reduces the number of tests. Use git bisect start, git bisect bad and git bisect good GOOD_ID; test each checkout and label it. git bisect run can automate a test whose exit status reliably indicates good or bad. Use git bisect reset when done.
A simplified model for building intuition. It does not read your sandbox; use the terminal for real behaviour.
Under the hood
Git blame attributes lines to commits in a selected revision, which helps locate relevant changes. It does not prove who caused a bug or who owns the code. Renames, moves and formatting may affect attribution; inspect git show and surrounding history. Bisect is most useful when the test is deterministic and works on historical revisions; skip untestable commits when needed.
Common mistake · important nuance
Do not use blame as a people-management metric. Treat both tools as evidence for debugging.