Created
May 6, 2015 08:31
-
-
Save swape/a8ac8f5cb9b85665cb15 to your computer and use it in GitHub Desktop.
This git hook is copying the prod branch to prod dir and dev branch to dev dir. Makes it easy to deploy.
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 | |
echo "-- running post receive --"; | |
while read oldrev newrev ref | |
do | |
if [[ $ref =~ .*/dev$ ]]; | |
then | |
git --work-tree=/var/www/html/dev --git-dir=/home/git/ checkout dev -f | |
fi | |
if [[ $ref =~ .*/prod$ ]]; | |
then | |
git --work-tree=/var/www/html/prod --git-dir=/home/git/ checkout prod -f | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment