Show commit history for a line or section in a file

I want to view the commit history for a section in a file. In particular, I am interested in two lines. I want to see what changes were made to these two lines that were returned several months ago or even the origin of the file. Is there a quick way to get changes using the command line? I know there are GUIs for git that allow you to do this, but I would prefer not to. I would rather use vim or sublime if I am going to do this.

Ideally, I want something like a commit hash, date, name, and change.

34hi5u3k 4/13/2013 Someone Name (Line 408)  $text = 'Something';
72wbedfj 4/05/2013 Someone Else (Line 408)  $text = 'Something else';
827y3hrj 3/29/2013 Someone Nice (Line 408)  $text = 'This one time...';
+4
source share
1 answer

Show all changes in lines 95-105 in $ filename:

git log -L 95,105:$filename

10 , $filename:

git log -L /<regex>/,+10:$filename

, , .

+1

Source: https://habr.com/ru/post/1531629/


All Articles