Created
January 2, 2016 12:22
-
-
Save 3ffusi0on/27562d864f011957e822 to your computer and use it in GitHub Desktop.
Git hook post-update
This file contains hidden or 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/sh | |
# | |
# Hook on repository update managing two branches dev and master | |
# in order to supervise production and development environnement. | |
# | |
echo $1 | |
echo "*Updating repository using Hook*" | |
case " $1 " in | |
*'refs/heads/dev'*) | |
GIT_WORK_TREE=/var/www/html/dev/ git checkout dev -f | |
echo "Dev environnement updated." | |
;; | |
esac | |
case " $1 " in | |
*'refs/heads/master'*) | |
GIT_WORK_TREE=/var/www/html/prod/ git checkout master -f | |
echo "Master environnement updated." | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Git hook used to execute different task depending on the branch which received the commit.