Back to lessons
Git Blame & Investigating History
Use forensic Git tools to trace changes and find when and why code was modified.
Step 1 of 617%
Git blame annotates every line of a file with the commit hash, author, and date of the last modification. It's your primary forensic tool for understanding how code evolved.
Git blame is often misunderstood as a tool for assigning blame in the negative sense, but it's really about understanding context. When you encounter confusing code, blame tells you exactly when it was last changed and by whom, letting you ask the right questions: Was this a quick fix under deadline pressure? Was it part of a larger refactoring? Combined with git show <hash>, you can see the full diff and commit message for context, making blame one of the most valuable tools for onboarding onto legacy codebases.
1 / 6