Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all current lines modified by an author

How would I in git determine all lines still in existence that were from a specific author. Say for example, a Tony had worked on my project and I wanted to find all lines in my develop branch that still exists and were from a commit that Tony authored?

like image 664
stevebot Avatar asked Aug 31 '15 22:08

stevebot


People also ask

How to git blame specific line?

Blaming only a limited line range Sometimes, You don't need to blame the entire file, you just need to blame in a limited line range. Git blame provides the option for that. -L will take the option for the start line and for the end line.

What git blame does?

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.

How to exit git blame?

You can also quit the git blame window using the q key on your keyboard.

What is git summary?

Git is a version control (VCS) system for tracking changes to projects. Version control systems are also called revision control systems or source code management (SCM) systems.


1 Answers

Maybe just git blame FILE | grep "Some Name".

Or if you want to recursively blame+search through multiple files:

for file in $(git ls-files); do git blame $file | grep "Some Name"; done

Note: I had originally suggested using the approach below, but the problem you can run into with it is that it may also possibly find files in your working directory that aren’t actually tracked by git, and so the git blame will fail for those files and break the loop.

find . -type f -name "*.foo" | xargs git blame | grep "Some Name"
like image 163
sideshowbarker Avatar answered Oct 20 '22 07:10

sideshowbarker