Using TortoiseSVN how do I merge changes from the trunk to a branch and vice versa?

Ryan Taylor picture Ryan Taylor · Nov 18, 2008 · Viewed 110.2k times · Source

I've been reading up on branching/merging with Subversion 1.5 using the excellent and free Version Control with Subversion book. I think that I understand how to use the Subversion command line client to perform the actions that I need most often, which are:

Update Branch with Changes from Trunk

From the branch's working directory run:

svn merge http://svn.myurl.com/proj/trunk

Merge Branch into Trunk

From the trunk's working directory run:

svn merge --reintegrate http://svn.myurl.com/proj/branches/mybranch

However, we are using TortoiseSVN 1.5 as our interface to Subversion. I would like to know how best to perform these operations with TortoiseSVN. The new dialog provides three different options on the main menu.

  1. Merge a range of revisions
  2. Reintegrate a branch
  3. Merge two different trees

From what I can gather, TortoiseSVN always executes svn with the following syntax.

svn merge [--dry-run] --force From_URL@revN To_URL@revM PATH

Additionally, reintegrate a branch often fails with a message stating that some targets have not been merged and so it cannot continue, and so I had to use option #3.

My questions are:

  1. How do I use TortoiseSVN 1.5 to merge changes from the trunk to a branch?
  2. How do I use TortoiseSVN 1.5 to merge the branch to the trunk, with and without the reintegrate method?
  3. Which of the above options should I use for each, and why?

EDIT

Through "dry run" testing I have found that the command line Subversion operation

svn merge http://svn.myurl.com/proj/trunk

is analogous to option #1 (Merge a Range of Revisions) in TortoiseSVN, as long as I leave the revision range blank.

Answer

icc97 picture icc97 · Mar 27, 2013

I couldn't properly follow the other answers, here's more of a dummies guide...

You can do this either way round to go trunk -> branch or branch -> trunk. I always first do trunk -> branch fix any conflicts there and then merge branch -> trunk.

Merge trunk into a branch / tag

  1. Checkout the branch / tag
  2. Right-click on the root of the branch | Tortoise SVN | Merge ...
  3. Merge Type: Merge a range of revisions | Click 'Next' enter image description here
  4. Merge revision range: Select the URL of the trunk directory that you copied to the branch / tag. Enter the revisions to merge or leave the field empty to merge all revisions | click 'Next' enter image description here
  5. Merge options: I just left these as default | click 'Merge' enter image description here
  6. This will merge the revisions into the checked out branch / tag
  7. Then commit the merged changes to the branch / tag