我正在尝试从 Git diff 中排除文件 (db/irrelevant.php
)。我尝试将一个文件放在名为 .gitattributes
的 db
子目录中,该行包含 irrelevant.php -diff
我还尝试创建一个名为 .git/info/attributes
的文件,其中包含 db/irrelevant.php
。
在所有情况下,db/irrelevant.php
文件作为 Git 二进制补丁包含在 diff 中。我想要的是 diff 命令忽略对该文件的更改。我做错了什么?
最佳答案
Omg,驱动程序和 awk 来排除一个糟糕的文件?自 git 1.9 something你可以:
git diff -- . ':(exclude)db/irrelevant.php' ':(exclude)db/irrelevant2.php'
(在 Windows 上,将单引号 '
替换为双引号 "
。)
啊,优雅!有关详细信息,请参阅引用的答案 this answer通过@torek
关于git - 从 "git diff"中排除文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10415100/