Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's what I ended up doing, this is a slight variation of what I proposed above and stems from another question I posted here: <a href="https://stackoverflow.com/questions/8327437/deploy-git-branches#comment10265979_8327437">Deploy git branches</a></p> <h1>One post-receive hook to rule them all.#</h1> <p>Post receive hook looks at the refname:</p> <p>If the refname = "refs/heads/master" (pushing to master branch):</p> <pre><code>echo "Updating production document root..." GIT_WORK_TREE=/data/hosts/production/web/ git checkout -f master echo "Production document root updated" </code></pre> <p>Then I use the post-receive-email hook that came with git to send a nice little email about the commit. Currently developing an API for our issue tracker so that we can close issues with commits etc. </p> <p>The same happens when refname = "ref/heads/develop" (pushing to develop):</p> <h2>Bonus Points</h2> <p>3 branches - production, develop (staging), and an issue tracker branch for small-ish projects. Sometimes though, we have larger projects that require long-term dev and can't get in the way of day to day dev. </p> <p>You can modify the post-receive hook to look for refs/heads/(.*?), which would fire if you did something like git push -u crazy-experimental-long-term-branch</p> <p>This lets us create a long term project branch, push it up with -u, and have a subdomain automatically set up at crazy-experimental-long-term-branch.site.com with some simple scripting.</p> <p>Day to day dev occurs, issue resolution rolls and gets greenlit (with weekly scheduled merges to production), and crazy experimental long term branches can be merged in when ready.</p> <p>I'm sure I am offending the sensibilities of the Git Gods with this deployment strategy, but we've been successfully deploying a large-scale application with this method for about 5 months and aside from the occasional merge conflict, haven't had any issues.</p> <p>Hope this is helpful.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload