A defense attorney's trial through commit history. Cross-examine the true origin of a bug — because git blame only ever names who touched a line last, never who is truly guilty.
Opposing CounselThe evidence speaks for itself, counselor. Or does it?
Case Docket — git log
×
The Attorney's Field Guide
Real commands, real limitations — the workflow behind this trial
git blame
git log -p
The Limitation
Archaeology Tips
What git blame actually tells you
git blame annotates every line of a file with the commit that most recently changed it — nothing more. It is a record of last contact, not a verdict of authorship or guilt.
$ git blame -L 40,44 cart.js
a1b2c3d4 (Priya Shah 2024-03-11) if (i <= items.length) {
a1b2c3d4 (Priya Shah 2024-03-11) applyDiscount(items[i]);
9f8e7d6c (Marco Reyes 2024-03-14) }
Notice only one hash shows up per line — the last editor. Every earlier author who ever touched that exact line has already been erased from this view.
Walking backward with git log -p
To see the full history of a single line — not just its latest author — attorneys (and engineers) walk the patch log for the file, reading each diff hunk in order.
This diff touches the line, but the logic (<=) is unchanged. It's cosmetic — a red herring for blame, but not for justice.
Why "last touched" ≠ "guilty"
Reformatting (whitespace, semicolons, style-guide passes) resets blame without changing behavior.
Merges can appear to "touch" every conflicting line, burying the true author.
Renames & moves (git blame -C -M helps, but isn't magic) can make old logic look brand new.
Misleading messages — a commit titled "Fix bug" can just as easily introduce one.
The rule of this courtroom: read the diff, not the headline. The true culprit is the earliest commit where the line's actual behavior flips from correct to broken.
Tools for real investigations
$ git log -S"items.length" -- cart.js
# finds commits that added/removed this exact string$ git bisect start
$ git bisect bad HEAD
$ git bisect good v1.2.0
# binary-searches history for the commit that broke a test$ git blame -w -C -M cart.js
# ignores whitespace, detects moved & copied lines
In this game, clicking through the Docket mirrors git log -p; tagging cards is your running hypothesis; filing an accusation is your final git bisect verdict.
×
Ready to Accuse?
You are about to formally accuse commit — of introducing the bug. This cannot be undone once the gavel falls.