我能告诉我一个用户修改过的所有文件吗?

时间:2011-06-14 19:44:18

标签: git

我希望git能够在所有提交中为我提供一个用户修改的所有文件的列表。

我的特殊用例是我参与了一个ruby on rails项目的i18n,我们想知道哪些文件已经完成以及哪些文件仍然需要完成。有问题的用户只完成了i18n的工作,而不是代码库的其余部分。因此,所有信息都应该是git,但我不知道如何解决它。

4 个答案:

答案 0 :(得分:169)

这将为您提供一个简单的文件列表,其他内容:

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

根据需要切换--committer的作者。

答案 1 :(得分:104)

这不是唯一的方法,但它有效:

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

或者,作为一行:

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

答案 2 :(得分:6)

试试git log --stat --committer=<user>。只需将用户名放在--committer=选项上(或根据需要使用--author=)。

这会吐出每次提交的所有文件,因此可能会有一些重复。

答案 3 :(得分:0)

git log --pretty= --author=@abcd.com --name-only | sort -u | wc -l

在git仓库中显示公司所有已修改的文件。

git log --pretty= --author=user@abcd.com --name-only | sort -u | wc -l

在git存储库中按作者名称“用户”显示所有修改的文件。