简体   繁体   中英

Merging problems: Which revision should I choose to merge from?

I have previously only had simple scenarios where I have branched from trunk, made some changes and then merged the changes into trunk. But this time it has gotten somewhat more complicated as the branch has had to merge in new stuff from trunk along the way, and now I do not know from which revision I am supposed to start the merge from branch to trunk. See picture below.

从主干合并到分支,然后再返回主干

The picture is supposed to depict a scenerio where mybranch is created in revision 10. A lot of changes are made, and then in revision 25 I merged some new features from the trunk into mybranch in order to create some new stuff. Ditto in revision 30. Further changes were made and I then tried to merge, but got a lot of conflicts, and for some reason I thought it might be easier to merge the new stuff from trunk into mybranch before trying to merge the changes in mybranch back into trunk again. But this is where I am lost - what revision should I specify as the starting point for the merge?

If I had not included any changes from the trunk it would have been easy:

svn merge -r11:HEAD http://repos.com/mybranch .

But now (in revision 35), mybranch basically has every new change in /trunk in addition to all the other changes. What should I do to merge the two into /trunk?

You should check out a clean, fresh trunk and merge with --integrate

merge --reintegrate <branch url>

For a lot more detail and discussion see the subversion book on line: http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.branchemerge.basicmerging.reintegrate

It's pretty safe to try this since nothing happens to your repository until you do a commit, giving you a chance to backout if you don't like how the merge goes.

EDIT: I should have stated more explicitly that in this case you merge from the HEAD of your branch to the HEAD of your trunk.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM