Skip to main content

Sign in

Save your progress and access it from any device.

Or with email

Don't have an account?

Privacy policy

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.

What does git blame show?

Anatomy of a blame line

a1b2c3d4(Anais2024-01-15 14:30)5)<meta charset="utf-8">
Hash

The commit that modified this line

Author

Who made the change

Date

When the change was made

Line

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

A

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.

Start the investigations