stevebot stevebot - 5 months ago 27
Git Question

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?


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

Or if you are looking for some different output than what you’d get from the above, please consider updating the question to be more explicit about the output you want.

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"