Reputation: 4192
I would like to know when a specific line in a specific file has been added/modified. Hence, I know the content of the line and would like to have the commit in which this line has been added/modified.
Upvotes: 0
Views: 155
Reputation: 29804
You can use git blame
:
git blame path/to/file -L17,18
Will show the history for line range 17-18.
Upvotes: 3
Reputation: 4192
Based on this answer, which basically answers the same regarding the deletion of some lines, the answer is rather simple:
git log -S 'content of the line in which you are interested' <file>
Upvotes: -1