Dave Kennedy Dave Kennedy - 8 days ago 6
Git Question

How do I list files modified on another branch?

Before I merge branch B into branch A, I'd like to see a list of files modified (or added, deleted, etc.) on branch B. I know I can:

git diff --name-only B


But that list includes files changed on A as well. I only want to see files that were changed on B (but it's okay if they were also changed on A).

This is pretty close:

git log --name-only ..B


But that splits the list into separate commits. How can I generate a single list of files modified on B?

Answer

If you consider "What are the differences between double-dot “..” and triple-dot “…” in Git diff commit ranges?", you can try:

git diff --name-only A...B

(you can see in this answer the git commit ranges used by git log)