Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Git, how can I list all files that exist in branch A that do not exist in branch B

Is there a Git command I can use that will list the names of all files that exist in one branch that do not exist in another branch?

Background: Someone deleted some history and then pushed origin/master. Some team members have been saying they are missing some files. I think I have recovered the missing files with a patch that I created from diff commands. I branched master after the point where history was deleted and applied my patch to the new branch. Now I'd like to simply see what files exist in the new branch that do not exist at the HEAD of the master branch. For now I just want the file names, regardless of content, and only for files that exist in the new branch and do not exist at the HEAD of master.

like image 888
DAC Avatar asked Feb 02 '15 19:02

DAC


1 Answers

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

like image 71
Andrew C Avatar answered Sep 28 '22 00:09

Andrew C