QA
Beginner LevelGit & GitHub

How does git blame identify who modified specific lines of code in a file?

❓ Interview Prompt: Explain git blame line-by-line inspection, commit hash attribution, filtering whitespace changes (-w), and line range flags (-L).

git blame <file> annotates every line of a specified file with the commit hash, author name, and timestamp of the last commit that modified that line. Use git blame -L 10,25 <file> to inspect specific line ranges.

Code Implementation Example

bash
git blame -L 40,60 -w src/app.js
💡Inspecting line-by-line code authorship using git blame.
🎯 Interview Key Takeaway

Use git blame -L start,end file to identify author names and commit hashes for specific lines of code.

#git blame#Authorship#History#Beginner
Back to all Git & GitHub Questions→

More Git & GitHub Interview Questions

Beginner LevelGit & GitHub

Compare git rebase versus git merge and explain how git bisect finds regressions.

Beginner LevelGit & GitHub

What is the difference between git init and git clone?

Beginner LevelGit & GitHub

What are the Three Trees in Git (Working Directory, Staging Area / Index, Commit History)?