Created
July 14, 2016 14:17
-
-
Save alexbonhomme/4f7e7c80284c87bf7528a9d4fc80f96c to your computer and use it in GitHub Desktop.
Push to deploy GIT 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 | |
while read oldrev newrev ref | |
do | |
if [[ $ref =~ .*/master$ ]] || [[ $ref =~ .*/develop$ ]]; | |
then | |
export branch=${ref:11} | |
echo "$branch received. Deploying $branch branch..." | |
git --work-tree=/home/user/www --git-dir=/home/user/repo checkout -f $branch | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment