gitgit-diff

How can I make 'git-diff' and 'git log' ignore new and deleted files?


Sometimes there are a couple of changed files together with some new, deleted and/or renamed files. When doing git diff or git-log, I'd like to omit them, so I can better spot the modifications.

Actually, listing the names of the new and deleted files without their content would be best. For "old" renamed to "new" I'd like to optionally get the difference between "old" and "new".


Solution

  • The --diff-filter option works with both diff and log.

    I use --diff-filter=M a lot which restricts diff outputs to only content modifications.

    To detect renames and copies and use these in the diff output, you can use -M and -C respectively, together with the R and C options to --diff-filter.