Want to exclude file from “git diff”

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

    It's very simple, you can exclude what you want using standard unix commands, those commands are available under git bash even under windows environment. Below example shows how to exclude diff for pom.xml files, first check diff to master only for filenames, then using 'grep -v' exclude files which you don't want and then run again diff to master with prepapred list:

    git diff master `git diff --name-only master | grep -v pom.xml`
    

提交回复
热议问题