Last active
January 23, 2018 17:51
-
-
Save pixelprogrammer/773334d38779767e10520c123040dce9 to your computer and use it in GitHub Desktop.
Keep file permissions and ownerships consistent after a git pull
This file contains 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/sh | |
previous_version=$(git rev-parse HEAD@{1}) | |
git submodule init | |
git submodule update | |
git whatchanged --no-commit-id --name-only -r $previous_version.. | sort | uniq | xargs -n1 chown yoursite:psacln | |
git whatchanged --no-commit-id --name-only -r $previous_version.. | sort | uniq | xargs chmod g+rw | |
find ./* -type d -exec chown yoursite:psacln {} \; | |
find ./* -type d -exec chmod g+rwx {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Directory paths are ignored so I will need to figure out a way to spit out the added directory paths