Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Naive" svn merge from branch into trunk?

I am using TortoiseSVN for my C++ project, and am trying to "reintegrate a branch" back into the trunk.

My case is simple enough so that for every file which has changed in the branch, I would like it to completely overwrite the matching file in the trunk. Unfortunately, TortoiseSVN is smarter than me, so it merges each pair of files - resulting in some inconsistent code. For example, some code lines which have been deleted in the branch are restored in the merged version.

Is there any way to force TortoiseSVN to use the naive merge behaviour of overwriting all the modified files?

Thanks, Dan

like image 961
Danra Avatar asked Feb 08 '10 09:02

Danra


People also ask

Can we merge two branches in svn?

In the From URL option, you should specify the branch to which you want to merge. For example, assume that there are 2 branches, branch A and branch B , and you want to merge branch B to branch A . In TortoiseSVN, click on Merge option and then select Merge two different trees option.

What is svn reverse merge?

Reverse Merge - Use Subversion reverse merge to roll back a change or multiple changes that have been committed to the repository, and then apply this to your working copy.


1 Answers

Here's how to do it just using SVN (no mucking about in the filesystem):

  1. Check out the trunk revision from which you created the branch (not the HEAD revision).
  2. Commit it to the repository (this undoes all subsequent trunk changes).
  3. Do your reintegrate-merge (your trunk working copy should now be identical to the branch.)
  4. Commit the merged trunk, and you're done!
like image 177
tzaman Avatar answered Oct 16 '22 14:10

tzaman