How to make git-diff and git log ignore new and deleted files?

后端 未结 3 1811
花落未央
花落未央 2021-01-30 01:19

Sometimes there\'s 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 the

3条回答
  •  孤独总比滥情好
    2021-01-30 02:03

    UPDATE: The accepted answer by Charles Bailey is the correct one; the desired functionality is already built into git.

    I'll leave this answer here since it might provide ideas for things that aren't built into git.


    git diff shows new and deleted files by comparing them to /dev/null. It shouldn't be too difficult to write something (I'd use Perl myself) that looks for /dev/null and filters out the following lines up to the next diff. Then git diff ... | the-filter.

    Renamed files are a different matter; I don't (yet) have a good answer to that.

提交回复
热议问题