1

Our team seems to be running into this problem over and over again. When we start on a project we create an integration branch from the master and call it stable. Now, each individual developer branches out from stable and once they are done, they create a pull request to the stable and do a squash and merge before closing it.

The problem happens when we want to merge stable back to master. We usually rebase on top of master but this leads to many conflicts since 2 months down the line master has a lot more commits than when we branched from.

I read some posts like - Git Workflows: Rebasing Published/Shared Branches and some of them seem to advocate merging master to stable from time to time before doing the final rebase of stable on top of master at the time of creating a pull request and then there was one What is the right git workflow with shared feature branches? which said that back merge from master to stable is a bad idea.

My question is - Is merging master to stable from time-to-time the ideal solution here to prevent the rebase conflict hell which we go through every time or are there any better solutions out there? If this was already answered please let me know.

We can't merge stable to master sooner because master requires the latest and greatest end-to-end functional production ready code.

linuxNoob
  • 600
  • 2
  • 14
  • 30
  • Who is merging to `master` in those 2 months? Do you have multiple `stable`-like branches? – maazadeeb Feb 13 '19 at 02:36
  • @Maaz Syed Adeeb `master` is like the central branch in which devs from different teams continuously merge their work. We only have 1 `stable`. Even if we do have multiple we'd still have to integrate all of them and check before being able to merge to `master`. – linuxNoob Feb 13 '19 at 02:38

1 Answers1

1

Is merging master to stable from time-to-time the ideal solution here to prevent the rebase conflict hell which we go through every time or are there any better solutions out there?

In your particular workflow, where master is actively modified while stable is updated... yes, even though it is not a best practice.

Ideally, master should not evolve much while your integration branch (stable) is updated.
An example of such workflow: gitworkflow, which uses a "next" branch as integration, but will then remerge the feature branch themselves directly to master (which has not change much since the last release)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250