-
-
Save AoiYamada/d0cb6692a58de40c2a7a30e5d2334916 to your computer and use it in GitHub Desktop.
post-receive hook for multiple branches
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 | |
while read oldrev newrev ref | |
do | |
branch=`echo $ref | cut -d/ -f3` | |
if [ "master" == "$branch" ]; then | |
git --work-tree=./path/under/root/dir/live-site/ checkout -f $branch | |
echo 'Changes pushed live.' | |
fi | |
if [ "dev" == "$branch" ]; then | |
git --work-tree=./path/under/root/dir/dev-site/ checkout -f $branch | |
echo 'Changes pushed to dev.' | |
fi | |
done | |
# Taken from: http://blog.ekynoxe.com/2011/10/22/git-post-receive-for-multiple-remote-branches-and-work-trees/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment