Created
June 20, 2013 13:12
-
-
Save aqlx86/5822529 to your computer and use it in GitHub Desktop.
git post-receive hook
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/bash | |
# | |
livepath="/path/to/your/live" | |
devpath="/path/to/your/dev" | |
while read oldrev newrev ref | |
do | |
branch=`echo $ref | cut -d/ -f3` | |
if [[ "master" == "$branch" ]]; then | |
git --work-tree=$livepath checkout -f $branch | |
echo 'Changes pushed live.' | |
elif [[ "development" == "$branch" ]]; then | |
git --work-tree=$devpath checkout -f $branch | |
echo 'Changes pushed to dev.' | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment