I followed this excellent http://toroid.org/ams/git-website-howto post to deploy code to my server using the Git post-hooks strategy.
I have a post-update file that looks like this:
GIT_WORK_TREE=/home/rajat/webapps/<project name> git checkout -f
Each time I push the code to the master branch, it is automatically deployed. Now I want to do this to support multiple branches, so that:
- git push origin master -----> deploys production code (/ home / rajat / webapps / production)
- git push origin staging ----> expands the code for staging (/ home / rajat / webapps / staging)
- git push origin test ----> expands the code for testing (/ home / rajat / webapps / test)
To do this, the post-update hook must figure out which branch has been updated. Is it possible?
git githooks
Rajat
source share