Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have talked my employer into finally jumping on version control...up until now my experience with git has been for personal projects and freelance work where everything is on one server, or small, this is a bit above my knowledge.

We are going to have 3 web-servers… test, staging, production. We are going to use beanstalk (like github) which will store our repositories remotely and beanstalk will deploy to our servers via sftp (or ssh or whatever we decide). Inside our htdocs folder we have a drupal multi-site install, and we have a bunch of stuff outside of drupal (landing pages, etc...). We would like to have all of our htdocs (except images, file folders, etc...) inside of version control.

Should we use one repository with multiple branches? Or 3 separate repositories, each with one branch since they will be deploying to 3 separate servers?

share|improve this question
up vote 3 down vote accepted

As the code is going to be the same or versions of the same code, it would be healthier to have a single repository and several branches, one for each purpose. If you are in doubt on which branching scheme to use, there are many proposals out there (i.e. git flow).

As with git is so easy to port stuff from one branch to the other and back in the same repository, having separate repositories will give you a lot of headaches.

Additionally, you can have two branches on a repository that have completely different content, like for example the Bootstrap project: their code is on master branch and the github documentation pages are on another one.

And with Amazon Beanstalk you have to specify the branch you want to push to each environment, to this won't be a problem.

Git is so flexible you'll love it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.