Share post receive hook

2016-09-09 MoreFreeze 更多博文 » 博客 » GitHub »

git

原文链接 https://morefreeze.github.io/2016/09/share-post-receive.html
注:以下为加速网络访问所做的原文缓存,经过重新格式化,可能存在格式方面的问题,或偶有遗漏信息,请以原文为准。


{% include JB/setup %}

I had shared a precommit here which help you check your code before your commit. If you want to deploy it on test machine even production machine, you may need this. <!--more-->

You just change DEPLOY_ROOT and DEPLOY_ALLOWED_BRANCH variable. I suggest change DEPLOY_ALLOWED_BRANCH to dev instead of master if you deploy to test machine. Here is the code.

Put post-receive in hooks/ of your remote repo. Set executable to it with chmod u+x hooks/post-receive. Just type git push remote dev and enjoy it!