Merge a Branch into Trunk


I'm facing a peculiar problem with SVN merge. I want to merge from a dev branch to trunk.
We have multiple dev branches cut off the trunk at the same time.

I'm merging one of those branches to trunk with this command:

svn merge trunk branch_1

I see changes that are not part of this branch, getting merged into trunk.
What am I doing wrong ?

SVN Version :

Subversion command-line client, version

Best Solution

Your svn merge syntax is wrong.

You want to checkout a working copy of trunk and then use the svn merge --reintegrate option:

$ pwd

$ svn update  # (make sure the working copy is up to date)
At revision <N>.

$ svn merge --reintegrate ^/project/branches/branch_1
--- Merging differences between repository URLs into '.':
U    foo.c
U    bar.c
 U   .

$ # build, test, verify, ...

$ svn commit -m "Merge branch_1 back into trunk!"
Sending        .
Sending        foo.c
Sending        bar.c
Transmitting file data ..
Committed revision <N+1>.

See the SVN book chapter on merging for more details.

Note that at the time it was written, this was the right answer (and was accepted), but things have moved on. See the answer of topek, and