Subversion: merging a commit from trunk to branch

Published: Sunday, 6 March 2011

How to merge a commit between trunk or branches

  • Determine the commit number in the source branch. In this example the commit number 344 in trunk.
  • Determine the source branch URL. You can see this by typing svn info in the top level directory. In this example, the source branch URL is at svn+ssh://svn.example.com/repos/calc/trunk
  • Checkout the branch and change directory into it. e.g. use svn co http://svn.example.com/repos/calc/branches/v2011
$ svn co svn+ssh://svn.example.com/repos/calc/branches/v2011
$ cd v2011

Merge changes from revision 344 in trunk to the branch

$ svn merge -r 343:344 svn+ssh://svn.example.com/repos/calc/trunk

You can now commit your changes into the branch.