Home DevOps Git Blame — Wrong Developer Got Flagged in Postmortem
Intermediate 3 min · July 07, 2026
Git Blame: Find Who Changed What and When

Git Blame — Wrong Developer Got Flagged in Postmortem

git blame showed Alice's name on a buggy line.

N
Naren Founder & Principal Engineer

20+ years shipping production infrastructure and CI/CD at scale. Everything here is grounded in real deployments.

Follow
Production
production tested
July 07, 2026
last updated
214
articles · all by Naren
Before you start⏱ 15 min
  • Solid grasp of devops fundamentals
  • Comfortable reading and writing code examples independently
  • Basic understanding of production deployment concepts
 ● Production Incident
Quick Answer

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.

✦ Definition~90s read
What is Git Blame?

git blame annotates each line of a file with the commit SHA, author, and timestamp of the last modification. It answers: who last touched this line, and in which commit?

Imagine a whiteboard where each word has a sticky note showing who last wrote it and when.
Plain-English First

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.

01_blame_basics.shBASH
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Basic blame — who last touched each line?
git blame src/app.ts

# Blame a specific line range
git blame -L 45,60 src/app.ts

# Ignore whitespace-only changes
git blame -w src/app.ts

# Detect lines moved from other files
git blame -C -C -C src/app.ts

# Find when a specific string was introduced
git log -S 'paymentService.process' -- src/app.ts

# Trace the full history of a file (including renames)
git log --follow -p -- src/app.ts
Output
a1b2c3d (Alice 2024-03-15) const x = 1
d4e5f6g (Bob 2025-01-20) const y = 2 # Bob's merge
a1b2c3d (Alice 2024-03-15) const z = 3
commit d4e5f6g
Author: Bob
Date: Mon Jan 20 14:30:00 2025 +0000
Merge branch 'feature'
Use -C -C -C for Deep Copy Detection
Three -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.
Production Insight
In postmortems, never accept git blame as sole evidence. Always verify with 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.
Key Takeaway
git blame shows the last modification, not the original author. Use -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.

02_pickaxe_search.shBASH
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Find commits that introduced or removed a function
git log -S 'processPayment' --oneline

# Find commits matching a regex pattern
git log -G 'TODO|FIXME' --oneline

# Follow a file through renames, showing full diff
git log --follow -p -- src/legacy/payment.ts

# Combined: find when a function was first introduced
git log --diff-filter=A -S 'processPayment' --oneline

# Show blame ignoring specific commits (formatting/refactor)
echo 'a1b2c3d' > .git-blame-ignore-revs
git blame --ignore-revs-file .git-blame-ignore-revs src/app.ts
Output
d4e5f6g Add payment processing
b2c3d4e Refactor payment module
commit d4e5f6g
Author: Alice
+function processPayment() {
+ // original implementation
+}
commit b2c3d4e
Author: Bob
- // old implementation
+ // new implementation (introduced bug)
Production Insight
Set up .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.
Key Takeaway
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.
● Production incidentPOST-MORTEMseverity: high

Blame Pointed at the Wrong Developer in a Production Postmortem

Symptom
A critical production bug was traced to a line of code. git blame showed Alice as the author. Alice had left the company. The postmortem blamed her code. Later investigation proved Bob introduced the bug in a merge conflict resolution two years prior.
Assumption
Everyone assumed git blame shows the original author. The line hadn't been touched since Alice's commit, so she must have written the bug.
Root cause
1. Alice wrote the original code (which was correct). 2. Two years later, Bob resolved a merge conflict in the same area and accidentally kept the wrong version. 3. Bob's merge commit became the 'last modification' according to git blame. 4. When the bug was found, blame pointed at Alice because no one had edited the line since Bob's merge. 5. The merge was invisible to a casual blame read.
Fix
1. Used 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.
Key lesson
  • git blame shows the LAST person to touch a line, not the ORIGINAL author.
  • Merge conflict resolutions overwrite blame.
  • Use git blame -w to skip whitespace, -C to detect moved code, and git log -S <string> to trace when a specific piece of code was introduced.
Production debug guideUse this when production is on fire3 entries
Symptom · 01
Need to find who last touched a specific line
Fix
Run git blame -L <start>,<end> <file>
Symptom · 02
Blame shows a formatting commit, want the original author
Fix
Run git blame -w <file> to skip whitespace, or git log --follow -p <file> to trace the real origin
Symptom · 03
Need to find when a specific line was introduced (not last touched)
Fix
Run git log -S 'the-string' -- <file> or git log -L <start>,<end>:<file>
⚙ Quick Reference
2 commands from this guide
FileCommand / CodePurpose
01_blame_basics.shgit blame src/app.tsReading git Blame Output Correctly
02_pickaxe_search.shgit log -S 'processPayment' --onelineUsing git log -S and -G to Find the Real Origin

Key takeaways

1
git blame shows the LAST person to touch a line, not the ORIGINAL author
2
Use -w to ignore whitespace, -C for copy detection, -S to find introducing commits
3
Maintain .git-blame-ignore-revs to exclude formatting commits
4
Never use blame as sole evidence in postmortems
N
Naren Founder & Principal Engineer

20+ years shipping production infrastructure and CI/CD at scale. Everything here is grounded in real deployments.

Follow
Verified
production tested
July 07, 2026
last updated
214
articles · all by Naren
🔥

That's Git. Mark it forged?

3 min read · try the examples if you haven't

Previous
Conventional Commits: Standardized Commit Messages
28 / 47 · Git
Next
Git Worktree: Work on Multiple Branches Simultaneously