git blame -L <start,end> <filepath>
Displays the author and revision details for specific lines in a file.
This command is used to uncover who modified certain parts of a file in a git
repository by showing the detailed author and revision information for the specified lines in the file.
The -L
flag followed by a range <start, end>
allows to restrict the output to the given lines range in the file. By default, the line numbers are interpreted as absolute line numbers.
You may as well specify the <start>
and <end>
parameters according to patterns. Each line numbers or pattern is separated by a comma. Note that end
line number is optional. If not provided, this command will consider from start
to the end of the file.
Specific examples:
git blame -L 10,20 file.txt