Last Updated: May 23, 2016
·
343
· acdesouza

Git log line selection

How to follow changes on lines of a file?

Since git 1.8.4 you can git log just a bunch of lines in a file.
$ git log -L<Line number>,<range>:<filename>

To see changes on lines 4 to 32, in app/assets/javascripts/application.js

$ git log -L4,32:app/assets/javascripts/application.js

To see changes on 10 lines, after line 20, in app/assets/javascripts/application.js

$ git log -L20,+10:app/assets/javascripts/application.js