Last active
June 29, 2021 07:09
-
-
Save ABGEO/bff12e6ec8cc14773814e13e943a7166 to your computer and use it in GitHub Desktop.
Reset the original permissions in local Git repository.
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
#!/bin/bash | |
# Version 1 | |
## 1) Create a reverse patch | |
## 2) Include only the permission changes | |
## 3) Apply the patch to our working copy | |
git diff -p -R --no-ext-diff --no-color | grep -E "^(diff|(old|new) mode)" --color=never | git apply | |
# Version 2: | |
## Add as git command | |
git config --global --add alias.reset-permissions '!git diff -p -R --no-ext-diff --no-color | grep -E "^(diff|(old|new) mode)" --color=never | git apply' | |
## Call: git reset-permissions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment