We have 2 teams of developers working on a single system. Team A is working on a ‘master’ branch (our production branch). They will branch from ‘master’ to feature or bugfix branches and merge back into ‘master’ for releasing.
Team B is working on an ‘upgrade’ branch which is branched from ‘master’. They follow a similar approach of branching from ‘upgrade’ to feature or bugfix branches and then merge back into ‘upgrade’ once their work is done.
Eventually the ‘upgrade’ branch will replace ‘master’ once the upgrade is complete. In the mean time how do we keep the ‘upgrade’ branch in sync with ‘master’?
To date I’ve been rebasing the ‘upgrade’ branch on ‘master’ weekly. The problem is that this rewrites history and creates chaos for members in Team B when they want to pull from or push changes to ‘upgrade’. How should we continuously integrate ‘master’ and ‘upgrade’ in a simple and clean manner?
So… don’t rebase. Fetch and merge
origin/masterto the local branchupgrade.The final merge back to
masterwill be an easy (or even fast-foward) one.See also:
deliverandrebasebasicsgit rebasevsgit merge“: to see the kind of workflow each operation supports.Rebase is good just before a merge.
But in your case, you won’t merge (back to
master) before a long time.So merge (to upgrade) is a sensible solution.