Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git blame on a line modified multiple times?

Tags:

git

blame

if a line is modified back and forth between 2 versions several times, git blame seems to show only the latest commits on that line.

would it be possible to let it show all commits on that line?

like image 619
teddy teddy Avatar asked Jun 14 '12 06:06

teddy teddy


People also ask

What does * mean in git blame?

Annotations for lines modified in the current revision, are marked with bold type and an asterisk. But I think it is important to clarify that this refers to lines modified in the current revision of the file, not the current revision of the repository.

How does blame work in git?

Summary. The git blame command is used to examine the contents of a file line by line and see when each line was last modified and who the author of the modifications was. The output format of git blame can be altered with various command line options.

Does git blame identify a particular commit?

The git blame command is used to know who/which commit is responsible for the latest changes made to a file. The author/commit of each line can also been seen. There are many other options for blame, but generally these could help.


1 Answers

I don't know about showing all commits on that line at the same time, but you can "drill" through each change to the line by using git blame SHA~ -- filename. With each iteration of the blame, just insert the next most "recent" SHA which modified that line.

Example: The first time you run git blame foo.php you see the line was modified by f8e2e89a, so then you exit out and run git blame f8e2e89a~ -- foo.php, git will then show you who modified the line before f8e2e89a. Rinse and repeat as necessary.

like image 55
Matt Styles Avatar answered Sep 20 '22 05:09

Matt Styles