9

I have many new files as well as some modified files that I added to my branch, and when I do git difftool master it diffs all modified files as well as opening up for all new files. I see things like

Launching WinMergeU.exe: /dev/null src/example1.cpp

It is rather annoying since it is somewhat pointless to looking at a diff of new files.

Is there a way to only have Git diff the modified files and ignore new files?

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Michael
  • 3,294
  • 2
  • 17
  • 12

2 Answers2

20

I just tested this answer, and it appears to work equally well with difftool.

git difftool --diff-filter=M
Community
  • 1
  • 1
merlin2011
  • 67,488
  • 40
  • 178
  • 299
6

Just adding to the answer of Merlin2011 :)

You are looking for --diff-filter=M to show only files Modified between the two branches.

From man git-diff

--diff-filter=[ACDMRTUXB*]

Select only files that are

A Added

C Copied

D Deleted

M Modified

R Renamed

T have their type (mode) changed

U Unmerged

X Unknown

B have had their pairing Broken

* All-or-none

Any combination of the filter characters may be used.

When * (all-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
love
  • 3,203
  • 2
  • 15
  • 34