Git Blame — Wrong Developer Got Flagged in Postmortem
git blame showed Alice's name on a buggy line.
20+ years shipping production infrastructure and CI/CD at scale. Everything here is grounded in real deployments.
- ✓Solid grasp of devops fundamentals
- ✓Comfortable reading and writing code examples independently
- ✓Basic understanding of production deployment concepts
git blame shows every line with commit hash, author, date. git blame -L 10,20 narrows to a range. Use git blame -w to ignore whitespace changes.
Imagine a whiteboard where each word has a sticky note showing who last wrote it and when. git blame is those sticky notes. It doesn't tell you who “owns” the code or who originally wrote it — it tells you who last changed each character, even if that was a merge or a formatting fix.
Teams use git blame to find who introduced a bug. But blame shows the LAST person to touch a line, not the ORIGINAL author. A formatting commit, a merge conflict resolution, or a whitespace fix all overwrite the blame trail. In the worst cases, the blame finger points at the wrong developer entirely. This guide covers how to read blame accurately, how to dig past cosmetic changes to find the real origin, and the production incident where blame misattribution nearly cost an engineer their reputation.
Reading git Blame Output Correctly
git blame output has four columns per line: commit SHA, author name, timestamp, and line number with content. The SHA links to the full commit details via git show <sha>.
The most misinterpreted column is the author. If a formatting PR ran git add . && git commit -m 'Format', every line in the file now shows the formatting commit's author. The original author is buried. The -w flag (ignore whitespace) skips blame entries that only changed whitespace. The -C flag detects lines moved or copied from other files.
To trace the actual origin of a line: git log -S 'specific string' -- <file>. This searches commit contents, not blame annotations, and finds the commit that INTRODUCED the string regardless of subsequent formatting changes.
-C flags detect lines that were copied from other files in the same commit, other files in previous commits, and even from files that were created in the same commit. This is the most reliable way to find where a line actually came from.git log -S <string> to find the introducing commit. Tools like git-machete and gitential can track 'true authorship' across refactors. Some teams add git blame --ignore-revs-file with a list of formatting/refactor commit SHAs to exclude them from blame output.-w to skip whitespace, -C for copy detection, and git log -S to find when code was actually introduced. Never use blame as the only data point in a postmortem.Using git log -S and -G to Find the Real Origin
When blame points at the wrong commit, git log -S (pickaxe) searches commit contents for a specific string being added or removed. git log -S 'functionName' shows every commit where the number of occurrences of 'functionName' changed.
The `-G` flag is more powerful: it shows commits where the patch matches a regex. git log -G 'pattern' finds structural changes even if the string count didn't change.
For tracking a line through renames: git log --follow -p -- <file> follows the file across renames and shows the full diff for each commit.
.git-blame-ignore-revs in your repository and populate it with SHAs of mass-formatting commits (Prettier, Black, rustfmt). Configure git config blame.ignoreRevsFile .git-blame-ignore-revs so every developer sees clean blame output. CI should update this file automatically after formatting PRs.git log -S (pickaxe) finds commits that changed a specific string. git log --follow tracks files across renames. .git-blame-ignore-revs excludes formatting commits from blame output. Use these tools to find the true origin of code, not just the last touch.Blame Pointed at the Wrong Developer in a Production Postmortem
git log --all --full-history -- <file> to see every commit touching the file, not just the final state. 2. Found Bob's merge commit in the history. 3. Used git show <bobs-merge-sha> to verify the conflict resolution introduced the bug. 4. Re-ran blame with -C -C to detect copy-paste origins. 5. Updated team training: blame shows last touch, not original author. Use git log -S and -C flags for deep tracing.- git blame shows the LAST person to touch a line, not the ORIGINAL author.
- Merge conflict resolutions overwrite blame.
- Use
git blame -wto skip whitespace,-Cto detect moved code, andgit log -S <string>to trace when a specific piece of code was introduced.
git blame -L <start>,<end> <file>git blame -w <file> to skip whitespace, or git log --follow -p <file> to trace the real origingit log -S 'the-string' -- <file> or git log -L <start>,<end>:<file>| File | Command / Code | Purpose |
|---|---|---|
| 01_blame_basics.sh | git blame src/app.ts | Reading git Blame Output Correctly |
| 02_pickaxe_search.sh | git log -S 'processPayment' --oneline | Using git log -S and -G to Find the Real Origin |
Key takeaways
-w to ignore whitespace, -C for copy detection, -S to find introducing commits.git-blame-ignore-revs to exclude formatting commits20+ years shipping production infrastructure and CI/CD at scale. Everything here is grounded in real deployments.
That's Git. Mark it forged?
3 min read · try the examples if you haven't