Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge trunk to branch in Subversion

Tags:

merge

svn

I'm using Subversion 1.4.6, and I cannot upgrade to version 1.5 right now.

The situation:

  1. The trunk has a lot of structural changes (i.e. moving files around, mostly).

  2. I have a branch that was recently merged from the trunk, but before the major changes.

What is the best way to merge the trunk to the branch?

What I had in mind:

  1. First carefully merge the branch to the trunk, by merging only the modified files in the branch to the trunk.

  2. Copy the trunk to the branch. What is the best way to do this without losing the branch history? Should I deprecate the branch and create a new one?


Okay, it looks like I didn't given SVN enough credit. It's smart enough after all. I was just put off by the output of "D" and "A", but in the background it did a move.

like image 400
Gilad Naor Avatar asked Dec 30 '08 06:12

Gilad Naor


People also ask

What is svn merge command?

Unlike svn diff, the merge command takes the ancestry of a file into consideration when performing a merge operation. This is very important when you're merging changes from one branch into another and you've renamed a file on one branch but not the other.

How do I merge two svn revisions?

To merge a range of revisions, use svn merge -r start:end from to where start and end are revision IDs. This will merge all revisions starting at start+1 up to and INCLUDING end . Note: it will NOT include the first revision (ex: -r3:45 will merge 4 through 45).


1 Answers

Is there something that prevents you from merging all revisions on trunk since the last merge?

svn merge -rLastRevisionMergedFromTrunkToBranch:HEAD url/of/trunk path/to/branch/wc 

should work just fine. At least if you want to merge all changes on trunk to your branch.

like image 157
Stefan Avatar answered Nov 08 '22 09:11

Stefan