I have followed this excellent write up http://toroid.org/ams/git-website-howto to deploy code to my server using Git's post-hooks strategy.
I have a post-update file that looks like this:
GIT_WORK_TREE=/home/rajat/webapps/<project name> git checkout -f
Everytime I push code to master branch, it gets auto deployed. What I want to do now is to make this support multiple branches, so that:
- git push origin master -----> deploys code to production (/home/rajat/webapps/production)
- git push origin staging ----> deploys code to staging (/home/rajat/webapps/staging)
- git push origin test ----> deploys code to test (/home/rajat/webapps/test)
For this, the post-update hook needs to understand which branch got updated. Is this possible ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…