I am not an expert in Git, but I have seen this done before (I just didn’t know the actual implementation behind it).
I have my main website at http://www.foobar.com but I want to have a testing subdomain at beta.foobar.com (or if that’s too complicated, a testing dir at foobar.com/beta)
Is there a way to have 2 branches in my Git repo that manage the main website and a subdomain so that I can do all my testing in beta, and when I find my code satisfactory, I can simply merge beta in the master branch?
If I am thinking about this problem the wrong way, please feel free to propose an alternative. Thanks!
This is pretty easy to achieve and is nothing specific to GIT, but depends on your webserver settings and the deployment process for your app. 2 easy steps:
/var/www/foobar.com/app/publicand subdomain from/var/www/foobar.com/subdomains/beta/public.../app/publicdirectory and the beta branch into.../subdomains/beta/publicThe process can also be automated with tools like Capistrano and the multistage extension.
EDIT in response to your comment:
In a serious project that you are not just doing for yourself, you should never update the files that are currently deployed. Here is the proposed setup:
As noted above, tools like capistrano make deployment dead simple and they can even keep a history of your different deployments. Look at this post for example to see how it is used for PHP deployments.