I want to view a list of the files that were changed in each commit in git log
. Another question asked about how to view the changed files for a single commit, and got the following response:
$ git diff-tree --no-commit-id --name-only -r bd61ad98
index.html
javascript/application.js
javascript/ie6.js
What I want to know is how to apply this to git log
. That is, what command should I run to get something like the following output?
commit 78b3ba12002f9cab5cbb57fac87d8c703702a196
Author: WD40 <example@example.com>
Date: Fri Apr 14 09:59:57 2017 -0500
Change more things
about.html
javascript/application.js
javascript/ie6.js
commit 0f98b1f7eda33a4e9cfaab09506aa8094044085f
Author: WD40 <example@example.com>
Date: Fri Apr 14 09:49:03 2017 -0500
Change some things
index.html
javascript/application.js
javascript/ie6.js
Additionally, if it's possible, I'd like to know how to do the same thing, but also display added and deleted files.
I've looked at the git log --format
options, but I couldn't find anything resembling what I want. I have a feeling it's not possible with git log, and may require stringing together the output from multiple git diff-tree
s, but I'm not sure how to go about that either without scripting (which may be the only way to accomplish what I want, but I thought I'd go ahead and ask since that would be my last resort).
git-log
has many, many options for displaying the changes. They're found in the docs as Common Diff Options, common because they're shared by many commands which can display commits, like git-diff-tree
.
--name-only
is what you want. There's also...
-p
to display the complete patch--stat
to display the files changes, and the number of changes--name-status
to show the name and how it changed (modified, deleted, ...)And much, much more!
So, for example, git log --name-status
might show something like:
commit 78b3ba12002f9cab5cbb57fac87d8c703702a196
Author: WD40 <example@example.com>
Date: Fri Apr 14 09:59:57 2017 -0500
Change more things
A about.html
M javascript/application.js
D javascript/ie6.js
commit 0f98b1f7eda33a4e9cfaab09506aa8094044085f
Author: WD40 <example@example.com>
Date: Fri Apr 14 09:49:03 2017 -0500
Change some things
A index.html
A javascript/application.js
A javascript/ie6.js
Where A
is added, M
is modified, and D
is deleted.