问题
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?

回答1:
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.
So... don't rebase. Fetch and merge origin/master
to the local branch upgrade
.
The final merge back to master
will be an easy (or even fast-foward) one.
See also:
- "About Git's merge and rebase": for
deliver
andrebase
basics - "git rebase vs git 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 tomaster
) before a long time.
So merge (to upgrade) is a sensible solution.
来源:https://stackoverflow.com/questions/12196098/git-continuous-integration-without-rebase-chaos