如何排除文件和目录git diff --no-index
?
例如,我想显示两个目录之间的差异project1
& project2
而忽略了他们的高层.git
目录(project1/.git
& project2/.git
)和他们所有的.DS_Store
files.
这并不完全是您所要求的,但它可能会给您带来您想要的结果:添加project2
作为远程project1
并且只是git diff
their HEAD
s.
git remote add other ../project2/.git
git fetch other
# Perform the diff
git diff other/HEAD
If your project2
还不是 Git 存储库,您可以暂时将其设为一个(小提示乔赛亚·约德为了他的comments):
# Set up project2 repo
cd ../project2
git init
git add .
# Add as remote from project1
cd ../project1
git remote add other ../project2/.git
git fetch other
# Perform the diff
git diff other/master
# Clean up
git remote remove other
cd ../project2
rm -r .git
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)