Is there a way to limit git diff
to changed files?
I'd like to see the differences between two commits, but exclude paths that don't exist in one or the other (additions/deletions). The following Perl one-liner illustrates most of what I want:
git diff master.. | perl -lnwe 'print unless /^(new|deleted) file/../^diff/ and not /^diff/'
But that leaves diff --git a/path b/path
lines for the files that were new or deleted. Plus it'd be much nicer if I didn't have to parse (also fails if any hunk contains anything matching /^diff/, for example).
Another alternative I tried was:
git diff --name-status (args) | perl -lnwe 'print if s/^M\s+//' | xargs git diff (args) --
Its output is better, but it still feels hackish.