Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'git difftool' with only modified files

Tags:

git

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?

like image 208
Michael Avatar asked Jul 09 '14 22:07

Michael


People also ask

How does git Difftool work?

git difftool is a Git command that allows you to compare and edit files between revisions using common diff tools. git difftool is a frontend to git diff and accepts the same options and arguments.


2 Answers

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

git difftool --diff-filter=M
like image 123
merlin2011 Avatar answered Sep 22 '22 06:09

merlin2011


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.

like image 20
love Avatar answered Sep 20 '22 06:09

love