6.4 Finding Out Who’s to Blame
You’re looking at a file in your project, and one block of code—it might be one line or ten—looks out of place. Or maybe there’s a set of nested conditions that you’re trying to wrap your head around so you can refactor it to make it more understandable.
Looking at the log of a file and differences between revisions can be
helpful, but there’s a more useful command when you need information
about a particular block of code. git blame
prefixes every line with the commit name, committer, and timestamp.
Here are the first two lines of git blame
output on hello.html with my last name shortened
so the output fits on the page:
|
prompt> git blame hello.html |
|
|
^7b1558c index.html (Travis S. 2008-09-21 ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access