Git: continuous integration without rebase chaos

拥有回忆 提交于 2019-12-11 00:11:59

问题


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 and rebase 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 to master) before a long time.
    So merge (to upgrade) is a sensible solution.


来源:https://stackoverflow.com/questions/12196098/git-continuous-integration-without-rebase-chaos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!