Filter git diff by type of change

后端 未结 5 1399
醉梦人生
醉梦人生 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:05

    To see all modified and new files you can use

    git diff --name-only --diff-filter=ACMR PREV_VERSION master
    

    PREV_VERSION is the hash of your first commit.

    To get an export as zip you can use this code

    git archive --output=export.zip HEAD $(git diff --name-only --diff-filter=ACMR PREV_VERSION HEAD)
    

    Note: .gitignore is not in export.zip

提交回复
热议问题