Can I get git to tell me all the files one user has modified?

Git

Git Problem Overview


I would like git to give me a list of all the files modified by one user, across all commits.

My particular use case is that I've been involved in the i18n of a ruby on rails project, and we want to know what files have already been done and what files still need to be done. The users in question have only done work on the i18n, not on the rest of the code base. So the information should all be in git, but I'm not sure how to get it out.

Git Solutions


Solution 1 - Git

This will give you a simple list of files, nothing else:

git log --no-merges --author="Pattern" --name-only --pretty=format:"" | sort -u

Switch --author for --committer as necessary.

Solution 2 - Git

This isn't the only way, but it works:

git log --pretty="%H" --author="authorname" |
    while read commit_hash
    do
        git show --oneline --name-only $commit_hash | tail -n+2
    done | sort | uniq

Or, as one line:

git log --pretty="%H" --author="authorname" | while read commit_hash; do git show --oneline --name-only $commit_hash | tail -n+2; done | sort | uniq

Solution 3 - Git

Try git log --stat --committer=<user>. Just put the user's name on the --committer= option (or use --author= as appropriate).

This will spit out all the files per commit, so there will likely be some duplication.

Solution 4 - Git

git log --pretty= [email protected] --name-only | sort -u | wc -l

Shows all modified files by company in the git repo.

git log --pretty= [email protected] --name-only | sort -u | wc -l

Shows all modified files by author name 'user' in the git repo.

Solution 5 - Git

If you only want the list of filename:

git log --author= --pretty=format:%h | xargs git diff --name-only | sort | uniq

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHamish DownerView Question on Stackoverflow
Solution 1 - Gith0tw1r3View Answer on Stackoverflow
Solution 2 - GitSteve PrenticeView Answer on Stackoverflow
Solution 3 - GitRobert S.View Answer on Stackoverflow
Solution 4 - GitAbhijeet KandalkarView Answer on Stackoverflow
Solution 5 - GitKnardView Answer on Stackoverflow