5
git diff <other branch> <this branch> 

will show me all differences, but files that don't exist in the current branch have no special indicator in that list.

4

There is the exact same question on SO.

You can use git diff-tree to achieve what you want

use -r to recursively descend through subtree and --diff-filter to restrict output to only certain types of diffs (for instance, deletions=D)

git diff-tree -r --diff-filter=D branchA branchB

| improve this answer | |
  • This is pretty much the simplest what I needed so I'll set this as accepted. Is there a way to hide all the hashes from displaying? – Amalgovinus Jul 16 '18 at 2:24
  • use with | awk '{print $NF}' at the end of the command – Yakir GIladi Edry Sep 22 '19 at 17:04
7

I'd like to used "--diff-filter" flag to as like you want:

git diff --diff-filter=[D|M|A] branch1 branch2

As:

  • D: sort files existing in branch1 only.
  • M: sort files have been modified
  • A: sort files existing in branch2 only.

You can use all of them at the same time, also with "--stat" flag for a quick view of the changes.

| improve this answer | |
  • great, thank you! – Lonely Apr 16 at 13:15
1

Use this:

git diff --name-only branch1 master
| improve this answer | |
  • Won't this show all files that differ, not only the missing ones? – Al.G. May 17 '16 at 19:24
  • It will show all the changes between the branches, you can filter by the status (deleted) if you need with the git status command – CodeWizard May 17 '16 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.