Can I make git diff ignore permission changes
I unadvertedly change the permissions of my entire tree and commit that change alone with other content changes.
I use something like :
tar -czf deploy.tar git diff --name-only v1 v2
to generate a tar with the modified files between two tags, the problem is that now because of the permissions change almost all my tree is listed as modified.
Is there a way that i could tell git diff
to ignore those files which only has the permissions changed?
这会告诉git忽略权限:
git config core.filemode false
I had this problem after intentionally removing the execute permission from source code files (~26K files). Then, git diff says that all files have changed! The answer with core.filemode does not help me since that only affects diffs against your working dir, not diffs against 2 commits in the repo.
The answer was to use the (big scary) filter-branch command. In particular, all you need to type is:
git filter-branch -f --tree-filter 'find * -type f | xargs chmod 644 ' -- --all
from the root of your working dir. Of course, be sure to make a copy of your repo first (cp -pr ~/repo.git ~/repo-orig.git or similar), in case you need to re-try.
Enjoy!
链接地址: http://www.djcxy.com/p/30016.html上一篇: 如何在不接受所有文本更改的情况下进行git接受模式更改?
下一篇: 我可以让git diff忽略权限更改