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 ... |
Get Pragmatic Version Control Using Git now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.