简体   繁体   English

Git log * .java文件和提交者

[英]Git log *.java files and committers

How can I get the list of all Java files in my repo and get the original author and every committer to that file since. 如何从我的repo中获取所有Java文件的列表,并从那以后获取原始作者和该文件的每个提交者。

My attempt is below but I'd like one line for each Java file and list of all committers after that. 我的尝试如下,但我希望每个Java文件都有一行,之后是所有提交者的列表。

git log --name-only --pretty=format:"The author of %h was %ae on %aD" -- '*.java'

I don't think you're far off but I also don't think it can be obtained directly with GIT, instead, list all tracked files first, then loop over each one. 我不认为你离我很远,但我也不认为它可以直接用GIT获得,而是首先列出所有跟踪的文件,然后循环遍历每一个。

for file in $(git ls-files | grep \.java$)
do
    echo "Looking at $file";
    git log --pretty=format:"The author of commit %h was %ae on %aD" -- $file;
    echo;
done

Note: Using git ls-files *.java will only list tracked java files in the current directory and not all java files in the repo. 注意:使用git ls-files *.java只会列出当前目录中的跟踪java文件,而不会列出repo中的所有java文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM