Git changelog for particular line numbers

I often need to go spelunking through code that predates my work on the codebase. Sometime looking through the commit history for a large file can be rather overwhelming if there are lots of commits not related to the particular section of the file you are interested in.

I recently discovered that git log has an option -L to specify line numbers. This allowed me to look at just the area of the file I needed to in the log:

git log -L 490,493:example.php

Leave a Reply

Your email address will not be published. Required fields are marked *