5

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'

1 Answer 1

1

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 git ls-files *.java will only list tracked java files in the current directory. Not all java files in the repo will be tracked.

Sign up to request clarification or add additional context in comments.

1 Comment

Is there a way to do this just with git ls-files and its parameter arguments?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.