104

This article sounds interesting, but I'm pretty sure the diagrams are wrong. http://guides.beanstalkapp.com/version-control/branching-best-practices.html

Shouldn't it be DEVELOPMENT > STAGING > PRODUCTION?

Merges should only flow in one direction: from feature and bug-fixes done in their own branch or in development into staging for testing. Once tested, you can merge those changes from development into production.

Here I get a bit confused. So I merge Staging to Master or Master to Staging?

I'm using a client called SmartGit and I get confused about this point. Normally I make a branch for a feature, commit to it, then switch to master and merge it to the branch (forward). So in this new workflow with Staging and Production, I create these two extra branches, then create a branch from master (aka dev) for my feature. Commit to it, then switch to Staging and merge (forward) to my feature branch? Does that sound correct?


Actually what made this so confusing is that the Beanstalk people stand behind their very non-standard use of Staging (it comes before development in their diagram, and it's not a mistake! https://twitter.com/Beanstalkapp/status/306129447885631488

Have decided to forget about Beanstalk and just go with Github.


Since I posted this, the Beanstalk people took my hint and renamed their stages, now calling Development "Stable".

4
  • 1
    You would want to merge fixes from staging to production. Merging to staging for the purpose of testing and then merging development to production when testing is complete leaves open the possibility of additional work on development getting merged to production that was never merged to staging. Commented Feb 25, 2013 at 17:06
  • Classic branching workflows are not easy to apply to Git as branches in Git are a lot more lightweight. They are just pointers to (single) commits within the history which itself can branch in many directions. That’s why it’s difficult to see branches as a “line” of separated development (this also applies to the diagrams in “A Successful Git Branching Model”). Commented Feb 25, 2013 at 17:35
  • yeah it's not exactly swimming lanes. But my question is more specifically: do I switch to Staging and merge to dev, or vice-versa? I'm new to git and get confused about this. Maybe I should address the question directly to the makers of SmartGit, my windows git client. Commented Feb 25, 2013 at 19:15
  • An exact question I was looking for. Searched Google and got this on first number. Yaay (y) Commented Jun 7, 2017 at 6:17

4 Answers 4

133

The thought process here is that you spend most of your time in development. When in development, you create a feature branch (off of development), complete the feature, and then merge back into development. This can then be added to the final production version by merging into production.

See A Successful Git Branching Model for more detail on this approach.

Sign up to request clarification or add additional context in comments.

4 Comments

+1 for "A Successful Git Branching Model". This has basically become the standard as far as git workflows go.
"A Successful Git Branching Model" is a bit complex for smaller projects with only few people involved. I prefer simpler method, where development is done in master branch and stable versions are tagged in master branch and they have their stable branch for patches if required. See stackoverflow.com/questions/14858075/… and scottchacon.com/2011/08/31/github-flow.html
@eykanal Do you merge development into production or feature into production ?
In this article there is no a staging branch. How do they deploy from dev server to staging? I only see how they deploy from dev to production directly - merge the dev branch to master, but this is not safe, since it skips the staging environment, isn't it?
10

We do it differently. IMHO we do it in an easier way: in master we are working on the next major version.

Each larger feature gets its own branch (derived from master) and will be rebased (+ force pushed) on top of master regularly by the developer. Rebasing only works fine if a single developer works on this feature. If the feature is finished, it will be freshly rebased onto master and then the master fast-forwarded to the latest feature commit.

To avoid the rebasing/forced push one also can merge master changes regularly to the feature branch and if it's finished merge the feature branch into master (normal merge or squash merge). But IMHO this makes the feature branch less clear and makes it much more difficult to reorder/cleanup the commits.

If a new release is coming, we create a side-branch out of master, e.g. release-5 where only bugs get fixed.

Comments

4

Actually what made this so confusing is that the Beanstalk people stand behind their very non-standard use of Staging (it comes before development in their diagram, and it's not a mistake!

https://twitter.com/Beanstalkapp/status/306129447885631488

Comments

3

one of the best things about git is that you can change the work flow that works best for you.. I do use http://nvie.com/posts/a-successful-git-branching-model/ most of the time but you can use any workflow that fits your needs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.