简体   繁体   中英

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.

My attempt is below but I'd like one line for each Java file and list of all committers after that.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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