Last active
August 29, 2015 14:03
-
-
Save Sonique/54caee5a00393522476b to your computer and use it in GitHub Desktop.
Put files from master branch to production folder
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 | |
echo "=================================" | |
echo "Post-receive script: START" | |
WORK_TREE="/site/folder" | |
GIT_DIR="/home/git/repos/site.git" | |
while read oldrev newrev refname | |
do | |
branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
if [ $branch == "master" ]; then | |
echo "Branch determined as master." | |
echo "Upgrading files in production directory." | |
git --work-tree=$WORK_TREE --git-dir=$GIT_DIR checkout -f | |
echo "Changing permissions." | |
chmod -R 774 $WORK_TREE/* | |
echo "Complete" | |
else | |
echo "Branch $branch skipped." | |
fi | |
done | |
echo "Post-receive script: END" | |
echo "=================================" | |
// #git #bash #script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment