Categories
Other Other Programming PHP Programming

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.

By Jack Slingerland

Founder of Kernl.us. Working and living in Raleigh, NC. I manage a team of software engineers and work in Python, Django, TypeScript, Node.js, React+Redux, Angular, and PHP. I enjoy hanging out with my wife and son, lifting weights, and advancing Kernl.us in my free time.

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

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 .

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 🙂

Comments are closed.