This is a post-receive file for use with your own private git server. Say you wanna deploy using git, but you have multiple branches that you want to deploy to multiple places. For instance, you have a 'dev' branch that should only deploy to dev.yoursite.com, and a 'master' branch that will only deploy to yoursite.com. Once you git init into the…
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/to/your/live/deployment/ git checkout -f $branch | |
echo 'Changes pushed live.' | |
fi | |
if [ "dev" == "$branch" ]; then | |
GIT_WORK_TREE=/path/to/your/testing/deployment/ git checkout -f $branch | |
echo 'Changes pushed to dev.' | |
fi | |
done |
@robrecord That's correct. It isn't a problem very often for me, but I have bumped into the issue before. If you have any suggestions, I'd be happy to merge 'em in!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It doesn't appear to remove any files in the working tree, only update them.