After struggling with and sorting out a workflow for web development with git, I've been tasked with adding in a staging server at the last second. We develop/test locally and push out to a repo, and now there needs to be a sandbox in between so people in other departments can play around and try out new things without breaking stuff.
Remote repo needs two long-running branches (in the spirit of nvie's branching model), master and develop.
We need to be able to push to one repo, and checkout the develop branch to test.site.com docroot, and when ready, merge develop into master and checkout master into site.com docroot
So on the server...
git init
git add .
git commit -m "Initial commit"
git checkout -b "develop"
And on our local machines...
git clone [email protected]:/repos/repo1.git
???
git push origin/develop (??? Updates test.site.com docroot)
And back to the server to make code live
git checkout "master"
git merge develop (??? Updates site.com docroot)
git checkout -b "develop"
And locally
git pull
Help with the question marks or alternative suggestions appreciated.
Edit: Am experimenting with some of the answers so far. Had come up with a completely hacky idea in the interim and thought I'd share:
One post-receive hook to rule them all.
We clone a bare repo and track develop. Push develop to origin/develop.
Post-receive - Set GIT_WORK_TREE to test.site.com, checkout -f develop
If the commit message contains "merge_master", sets GIT_WORK_TREE to site.com docroot,
git checkout master
git merge develop
git checkout -f master (this would be for hotfixes)
Merge master back into develop and pull locally
After the dust settles, send email with difflog, wring your hands and have a sip of something strong.
How many different ways could that break?