GIT - How to list only newly added files between two branches

Filip Majernik picture Filip Majernik · Oct 7, 2013 · Viewed 10.9k times · Source

how can I list newly created(added) files between two branches? I can list all files that have been changed with:

git diff --color --name-only branch1..branch2

But that also contains files, that just changed their content, not necessarily new files. Is there some git command for this, or do I have to checkout each branch and compare the files, e.g. with bash? Thanks.

Filip

Answer

Jakub Narębski picture Jakub Narębski · Oct 7, 2013

You can use --diff-filter option of git diff:

git diff --color --name-only --diff-filter=A branch1 branch2