Find all current lines changed by the author

How could I in git identify all existing lines that were from a particular author. Say, for example, Tony was working on my project, and I wanted to find all the lines in my development branch that still exist and were made from the message that Tony wrote?

+7
git version-control blame git-blame
source share
2 answers

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

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

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

Or, if you are looking for some other result than the one you got from the above, consider updating the question in order to be more explicit regarding the conclusion you want.

Note. I originally suggested using the approach below, but the problem you may run into is that it can also find files in your working directory that arent actually being tracked by git, and therefore git blame will fail for these files and break cycle.

 find . -type f -name "*.foo" | xargs git blame | grep "Some Name" 
+7
source share

sidehowbarker is basically the correct but fixed second command:

 find . -type f -exec git blame {} \; | grep "Some Name" 

Although I would prefer:

 for FILE in $(git ls-files) ; do git blame $FILE | grep "Some Name" ; done | less 
+7
source share

All Articles