简体   繁体   中英

Reintegrating from branch to trunk, then merge back into branch in SVN .. what happens?

What's the appropriate way to do the following -

  1. There's trunk. I create a branch
  2. I work on branch. Make changes.
  3. Meanwhile trunk has changed, so I keep doing cd branch; svn merge $SVNTRUNK cd branch; svn merge $SVNTRUNK in my branch every once a while.
  4. Finally, I do cd trunk; svn merge --reintegrate $SVNBRANCH cd trunk; svn merge --reintegrate $SVNBRANCH . All this I just do following the SVN book.

What's the right way to do something on my branch now? Should I just delete my branch, and create a new branch from the trunk? If I do a cd trunk; svn merge $SVNTRUNK cd trunk; svn merge $SVNTRUNK I get a whole bunch of "local add, incoming add upon merge" messages ...

What are those? How do I resolve this?

I assumed SVN would cleanly realize that all those files listed as "local add, incoming add upon merge" are the same as the ones I already have in my branch .. but apparently not.

Well, the manual is quite explicit :

Once a --reintegrate merge is done from branch to trunk, the branch is no longer usable for further work. It's not able to correctly absorb new trunk changes, nor can it be properly reintegrated to trunk again. For this reason, if you want to keep working on your feature branch, we recommend destroying it and then re-creating it from the trunk.

In short: destroy your branch, create a new one (don't be afraid to create new branches often, it's a very lightweight thing on the server side).

Generally I would advise to use a short-living branches focused on a single feature/task/change which takes more than one commit. In this case the correct action after reintegrating is to delete the branch.

If for some reasons you want to use branches with longer lifetime, after reintegration, merge that single reintegrating revision to the branch with option "record only".

Here is description of this approach: http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.branchmerge.advanced.reintegratetwice

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