git blame
Find out who last changed each line of a file, and in which commit
What it does
git blame prints a file line by line, each with the short hash, author and date of its last change. That is how you find when and why an odd line appeared: open its commit with git show and read the message.
-L limits the output to a range of lines, for example -L 10,20. Despite the name, it is not about finding someone to blame: it is the fastest way to understand the history of the code.
Syntax
git blame <file>
git blame -L <start>,<end> <file>Examples
Find out who changed each line of src/app.js and in which commit
git blame src/app.jsblame— author and commit for every linesrc/app.js— file