Filter git diff by type of change

后端 未结 5 1408
醉梦人生
醉梦人生 2020-11-28 01:36

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 t

5条回答
  •  不知归路
    2020-11-28 02:07

    You are looking for --diff-filter=M to show only files *M*odified between the two branches.

    From man git-diff

    --diff-filter=[ACDMRTUXB*]

    Select only files that are

    • A Added
    • C Copied
    • D Deleted
    • M Modified
    • R Renamed
    • T have their type (mode) changed
    • U Unmerged
    • X Unknown
    • B have had their pairing Broken
    • * All-or-none

    Any combination of the filter characters may 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.

提交回复
热议问题