I am thinking of a way to do collaboration between coders in a company, suppose we have 2 type of servers: Production and Staging. Now we want to review all changes going to Production via pull-request, at the same time, we want coders to be able to push experimental changes whenever they want to Staging. The objective here is make sure our guys can do experimental stuff and can't (accidentally) mess up with Production.

My idea is to just create 2 separate repository for Production (read-only) and Staging (read-write). Will this be the ideal setup? enter image description here

  • 1
    There's no reason to have different repositories for production and master. It may be worth looking at Git Flow; if only to take away the ideas about having a 'develop' branch for testing, a 'master' branch and 'release-' branches for releases. Combined with tagging properly, this can enable you to keep track of releases, use one single repository and constantly have access to all releases - legacy or not. – Fergus In London Sep 8 '14 at 9:07
  • @FergusMorrow Using a single repo can I restrict someone from writing to certain branch? I'd like to have a setup whereby production branch/repo can only be written by authorised users (repo admins). GitFlow seems more like branch management tool, I don't know how it can stop 7-8 programmers from banging production branch (purposely or accidentally). – kecebongsoft Sep 8 '14 at 10:06
  • Git doesn't do Branch permissions out of the box as far as I know, unless you're running your own server and you use something like Gitolite. If you use "Git-flow" you can help minimise the risk of this happening accidentally somewhat, however there's no way to stop it happening purposefully as far as I know. (I'm going to post an answer with a potential solution) – Fergus In London Sep 8 '14 at 13:16
  • I just found out Bitbucket has this feature to allow only certain people to push to specific branches. So I think I don't have to fork anymore, still, I'm waiting for other approach if anybody has one. – kecebongsoft Sep 9 '14 at 3:22
  • @kecebongsoft there are commercial servers that allow you to impose business rules on the branches. Stash is one such. – user40980 Sep 23 '14 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.