I want to set up Git so I can have various versions of the same website accessible simultaneously. For example, a 'Sandbox' site, a 'Staging' site and a 'Production' site.
I currently have Git 1.7.11 installed on Windows, and Git running on my CentOs 5.5 VPS. Locally I have 2 branches, 'master' and 'dev'. Remotely I have 2 branches, 'master' and 'dev'.
I have followed the following tutorial showing how to manage a website using Git, but now feel I'm being rather stupid. I can commit files to either the dev branch or master branch from my local machine to the remote one, and these are checked out using a post-update hook into my Apache 'htdocs' directory. This works great, and as I switch branches the file 'changes'.
However, I want to have both versions accessible at the same time so I can run a site whilst a client can review a staging version of the same site. How do I do this? Afterward I plan to use Git to merge staging / dev into master.
Is this the best way? Checkouts in the post-update hook?
GIT_WORK_TREE=/htdocs/production git checkout master -f
GIT_WORK_TREE=/htdocs/staging git checkout dev -f