List all modified files in git merge commit - even the fast forwarded

soupdiver picture soupdiver · Feb 5, 2013 · Viewed 42.4k times · Source

I'm thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modified in both branches. This would give me a better overview of what was changed in the branch just by seeing the merge commit. Is there a way to do this?

Answer

Schleis picture Schleis · Feb 5, 2013

I don't know how to do that in the commit message. But after the merge, this will give the names of all the files affected by the merge commit:

git log -m --name-only

For only a list of filenames of the commit:

git log -m -1 --name-only --pretty="format:" <Merge SHA>

There is some white space due to the merge having two parents but that can be easily removed.