5

https://stackoverflow.com/a/5493663/1172541 explains how you can do a git log command for a file. Is there a way to track how part of a file changed with git log or other git command? (Of course, this would definitely strains git's diff engines, as the length and line numbers of the part changes. git is pretty good at that thing though.)

Community
  • 1
  • 1
PyRulez
  • 9,505
  • 9
  • 37
  • 82
  • Possible duplicate of [Retrieve the commit log for a specific line in a file?](http://stackoverflow.com/questions/8435343/retrieve-the-commit-log-for-a-specific-line-in-a-file) – genpfault Feb 01 '16 at 16:25

1 Answers1

14

Yup.

git log -L<start>,<end>:<file>

For example,

git log -L55,65:app.js 

will show a log for lines 55-65 in app.js.

To view a single line, use the same value for both start and end

git log -L55,55:app.js

Also works with gitk

gitk -L55,65:app.js
PyRulez
  • 9,505
  • 9
  • 37
  • 82
sfletche
  • 36,606
  • 25
  • 86
  • 108