Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法将不同 gitignore 文件的路径(或通过管道传递 gitignore 文件的内容)传递给 git 命令?
基本上我想做,git diff --no-index path1 path2但我想让 git 忽略一些文件,有没有办法?
git diff --no-index path1 path2
您不能将要排除的文件指定为git diff命令行的一部分。但是,您可以列出所有要比较的文件。第一种技术是使用通配符,例如:
git diff
git diff --no-index dir1/*/dir2/*.h
另一种选择是用于xargs创建文件git diff,如:
xargs
ls <whatever matches> | xargs git diff --no-index --
当然,在上面,ls可能需要更多的东西。
ls