How do I merge two svn branches?

I have two svn branches checked out, "b1" and "b2". I would like to merge all of my commits from the "b1" branch onto the "b2" branch. I have tried something like

svn merge -r HEAD:HEAD b1 b2 

but it does nothing. I am sure I have this command wrong but I can't find good documentation on it. I would like to do this on the client side and not create a third branch.

Any ideas?

Thanks!


Your problem is with the -r flag. You have to specify a range of revisions. So for example:

svn merge -r 13:HEAD b1 b2

To figure out the correct revision number you can do:

svn log --stop-on-copy b1

log will then only list commits which happened on b1. The smallest revision number you'll see will be your pick.

I've never used this form though. I always ensured that I was actively on branch b2, and then did:

svn merge -r 13:HEAD url://to/branch/b1

The "svnmerge" or "svnmerge.py" command can help with this. Note, this is a different command than "svn merge". More information is available at the svnmerge.py Wiki page including details on how to use it, a quickstart guide, etc.

I have used it to manage merging between several checkouts of one particular repository, where I make changes in one, then merge the changes from that branch into the other branch, which may have changes of it's own which are not merged back. For this usage, svnmerge.py has worked fantastically.

Sean