Merging from branch to trunk with 'Merge range of revisions'

帅比萌擦擦* 提交于 2019-12-03 03:25:20

It is call "rebasing" before merging back: you "rebase" (or update) your local branch with trunk evolutions before merging back that local branch to trunk.

It allows for slow resolution of the merge within your "a branch", with possible intermediate commits.
Then, when all is done, you can do a trivial merge back to trunk.
That way, you do not have to delay commits only because you are merging on trunk (since only stable commits should be allowed on trunk).

Would you consider it harmful to use approach 'A'?

No, if the merge is a trivial one, with a predictible result. In that case, approach B would be a waste of time, an extra merge which is not needed (and you should always seek to make as few merges as possible: each of those operations can be error-prone)

But if the result is not well defined in advance, then approach 'B' is definitively recommended, and allows you to explore the result of the merge in your own branch, before impacting 'trunk'.

Both approaches are useful, one should not seek to apply only one or only the other, but the one most adapted to the situation at hand.

Regarding Merge range of revisions versus Reintegrate a branch:

Following Method B results in having two kinds of commits in branch:

  1. Changes unique to branch
  2. Trunk changes picked from trunk by doing successive Merge range of revisions

When merging back to trunk, you must pick only changes unique to branch. This is done by Reintegrate a branch.

Using Merge range of revisions at the end would bring to trunk a mix of both duplicated trunk changes and private branch changes.

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