SVN Merge Example (Trunk to Branch)

I’m often in the situation where I need to merge changes from the trunk development into a branch.  I can never, EVER, remember the command, so I’m putting in here in hopes that I can reference it again and that other people might find it useful.

svn merge -r x:y svn://repositoryURL/repo/trunk/ .

So, how does it work? X is the revision that you branched at. This can also be the revision that you last merged changes from. Y is the version that you want to merge up to.  In most instances, HEAD is probably what you’re looking for.

Note:  Using –dry-run if you want to see the changes that will be made before actually doing it.  It takes some of the “this is scary” out of merging.

Author: Jack Slingerland

I'm a software engineer working and living in Raleigh, NC. I work in Python, Django, Node.js, React+Flux, AngularJS, and PHP. I like to work out with Kettlebells, run, and spend my free time with my wife, cat, and dog.

3 thoughts on “SVN Merge Example (Trunk to Branch)”

  1. If you are using SVN 1.6 (it may apply to 1.5 too) it does track merging history, so you don’t have to remember the branching release.
    The short version would be svn merge ^/repo/trunk .

  2. Thanks, really easy command and i finally got merge working 🙂
    Strange how many developers there is out there that say they know SVN but almost none of them know how to merge . I’m one of them 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *