Jostein Topland
Jostein Topland

Reputation: 1020

Which branching strategy with multiple branches using Git?

We are relatively new to Git using it with a branch setup with multiple branches, i.e. not just having one branch and then applying feature branches.

Our branching model consists of the following (in this order):

As of today, we first apply changes to Development and when use Cherry Picking to the next branch above, i.e. System Test. We then do Cherry Pick again to QA and do thoroughly testing. Changes may not necessarily go to Master, since some changes may be put on hold or postponed.

Using Cherry Picking is cumbersome for us, especially if a change is old and consists of many commits. There is also the risk of breaking code, since auto-merging may fail. Auto-merging is also difficult, due to source code also containing binary data.

We would like to simplify the steps for applying changes. From previous projects, using feature branches has been the way to make this easier. We struggle on how to apply this method, since there are multiple branches to take into account, and some changes may not necessarily reach Master.

I'll try to explain how we would like to use Git with our setup:

Creating a change: A feature branch is first created from Master. Any change is pushed to that feature branch. This feature branch should only be merged from Master.

Applying change to a branch: The feature branch is merged into any of the main branches, but Development first, then System Test, etc. A feature branch may be pused to QA, but not necessarily to Master. Some feature branches may be related to a later change and can be put on hold for a longer period.

Which strategy would be most suitable for this branching model using Git? How can we use Git in its best way for how it is supposed to be used.

Upvotes: 0

Views: 386

Answers (1)

Marina Liu
Marina Liu

Reputation: 38136

There is a successful git branching module you can refer. We usually checkout feature branches from develop. You can also follow it.

  • Checkout feature branches from develop.
  • Merge feature branches into System Test branch.
  • Merge System Test branch into QA.
  • When it’s ready and passed by QA team, then merge QA into master/production.

It’s more efficient than cherry-pick. And you can also hold on some changes in feature branches.

Upvotes: 1

Related Questions