Git blame: who modified this line?
git blame shows the author, date and commit for each line of a file. An essential tool for understanding the history of your code.
By Anaïs Sparesotto, web developer and head of education · Updated
What does git blame show?
Anatomy of a blame line
The commit that modified this line
Who made the change
When the change was made
The line number
Git blame in practice
Basic blame and advanced options.
Basic blame
Useful options
Essential blame options
git blame <file>Full blame of a file
git blame -L 10,20 <file>Blame lines 10 to 20 only
git blame -w <file>Ignore whitespace changes
git blame -C <file>Detect code copied from other files
git blame --since="2 weeks"Blame since a given date
git blame --ignore-rev <hash>Ignore a commit (e.g. reformatting)
Part of the Git History, Search & Debug guide
GitQuest is created by Anaïs (nouvelle fenêtre), web developer and head of education, specializing in tech training and digital accessibility.
Questions about git blame
Practice Git commands in GitQuest
GitQuest investigations teach you to explore code history to solve mysteries.