Want to exclude file from “git diff”

后端 未结 13 1919
梦谈多话
梦谈多话 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:58

    I do the following:

    git add *pattern_to_exclude*
    git diff
    git reset HEAD .
    

    I know it's not an elegant solution and it sometimes canot be used (eg. if you already have stuff staged) , but it does the trick without having to type a complicated command

提交回复
热议问题