Want to exclude file from “git diff”

后端 未结 13 1916
梦谈多话
梦谈多话 2020-12-07 07:27

I am trying to exclude a file (db/irrelevant.php) from a Git diff. I have tried putting a file in the db subdirectory called .gitattributes

13条回答
  •  独厮守ぢ
    2020-12-07 07:52

    Simplest answer

    git diff ':!db/irrelevant.php'

    It's just ':!' after your diff command. The diff command can be as complicated as you like, and you can use wildcards like *.min.js or add multiple excludes (space separate the quoted blocks) if you want.

提交回复
热议问题