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

后端 未结 3 1848
花落未央
花落未央 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 01:51

    • Offical document:
    --diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]]
    

    Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can 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.

    Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.

    Example: show only added , changed, modified files exclude deleted files:

    git diff --diff-filter=ACM
    

提交回复
热议问题