0

I would like to git log file and have it show the full commit details, including all files affected by that commit, like git log --stat=999,999 produces.

For example, git log --stat=999,999 path/to/file shows a diffstat of just that one file and if its associated commit had more files in it then it won't show them. I'd like it to show all files of the commit.

1 Answer 1

3

You can get what I think you are looking for with:

git log --format=%H $filename | while read x; do git show --stat $x; done

or

git show --stat $(git rev-list HEAD -- $filename)

(These are variations on a theme.) If you have to deal with historical renames, you may want to use git log --follow.

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

3 Comments

Nice work. That second one was what I was hoping for.
Too bad I can't git alias that but it works okay as a bash function: git-log-file () { git show --stat $(git rev-list HEAD -- "${@}") }
You can shell out in a git alias, so you could do !bash -c 'git show --stat $(git rev-list HEAD -- \"$@\")' _. (eg, either write that directly in a .gitconfig, or execute git config alias.lg '!bash -c '"'"'git show --stat $(git rev-list HEAD -- "$@")'"'"' _'

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.