Last active
March 5, 2025 15:32
-
-
Save jtdp/5443498 to your computer and use it in GitHub Desktop.
Revert file permission changes in local git repository.. Very useful when you change permissions due to working on a samba share. Lifted from: http://stackoverflow.com/questions/2517339/git-how-to-recover-the-file-permissions-git-thinks-the-file-should-be
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff -p \ | |
| grep -E '^(diff|old mode|new mode)' \ | |
| sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \ | |
| git apply |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If this solution does not work for you, I have found two possible causes -
It isn't a solution, in that it doesn't change or fix file permissions, but if you are stuck with one of the above, it may ease the pain to set:
though using this setting is highly not recommended generally.