git diff: add option for omitting the contents of deletes
- From
Mart Sõmermaa <mrts.pydev@gmail.com>
- Date
- Feb 26, 2011, 13:16 UTC
- Message-ID
- <AANLkTi=++gcw5CDQnTRbhUGkvWc9Zm+Ct4Zm5oGGYKUh@mail.gmail.com>
Paging through deletes adds a cognitive burden when reviewing code. Thus we have
git config --global alias.deleteless-diff 'diff -M --diff-filter=ACMRTUXB'
and using `git deleteless-diff` is standard practice during code reviews.
However, the filter leaves out delete information altogether, which is error-prone.
Therefore I'd like to propose adding the -D (or --omit-delete-contents) option to git diff that would behave as follows:
$ git rm foo $ git diff -D
diff --git a/foo b/foo delete foo I.e. instead of displaying the contents of the file as a diff minus, a descriptive message is displayed -- like with renames. Thoughts, suggestions? Can 'diff -M --diff-filter=ACMRTUXB' be improved? Best regards, Mart Sõmermaa