Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.4k points)

Is there any way to get git to give you a commit log for just commits that touched a particular line in a file?

Like git blame, but git blame will show you the LAST commit that touched a particular line.

I'd really like to get a similar log of, not the list of commits to anywhere in the file, but just the commits that touched a particular line.

1 Answer

0 votes
by (27.5k points)

This command should work: 

$ git log -u -L <upperLimit>,<lowerLimit>:<path_to_filename>

In this case upperLimit & lowerLimit is the touched line_number

-u is the first line and -L is used to specify the end line of the part for which we intend to see the changes.

Browse Categories

...