Skip to content

Instantly share code, notes, and snippets.

@pixelprogrammer
Last active January 23, 2018 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixelprogrammer/773334d38779767e10520c123040dce9 to your computer and use it in GitHub Desktop.
Save pixelprogrammer/773334d38779767e10520c123040dce9 to your computer and use it in GitHub Desktop.
Keep file permissions and ownerships consistent after a git pull
#!/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 {} \;
@pixelprogrammer
Copy link
Author

Directory paths are ignored so I will need to figure out a way to spit out the added directory paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment