Want to exclude file from “git diff”

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

    Omg, drivers and awk to exclude a lousy file ? Since git 1.9 something you can:

    git diff -- . ':(exclude)db/irrelevant.php' ':(exclude)db/irrelevant2.php'
    

    Ah, elegance! See the quoted answer and for details this answer by @torek

提交回复
热议问题