Tutorial by Examples

git blame <file> will show the file with each line annotated with the commit that last modified it.
Sometimes repos will have commits that only adjust whitespace, for example fixing indentation or switching between tabs and spaces. This makes it difficult to find the commit where the code was actually written. git blame -w will ignore whitespace-only changes to find where the line really came fr...
Output can be restricted by specifying line ranges as git blame -L <start>,<end> Where <start> and <end> can be: line number git blame -L 10,30 /regex/ git blame -L /void main/, git blame -L 46,/void foo/ +offset, -offset (only for <end>) git blame -...
// Shows the author and commit per line of specified file git blame test.c // Shows the author email and commit per line of specified git blame -e test.c file // Limits the selection of lines by specified range git blame -L 1,10 test.c

Page 1 of 1