SVN: replace the trunk with a branch

It is rather nightmarish when you need to merge the branch back into trunk because there are bound to be the many merge conflicts. To avoid torture, you could replace the trunk with you branch. This is especially attractive because you will retain the history of the branch. The solution proposed:

$ svn copy file:///repos/trunk file:///repos/tag/old_trunk -m "copied old trunk as tag"
$ svn del file:///repos/trunk -m "Temporarily deleted trunk."
$ svn copy file:///repos/branches/your_branch file:///repos/trunk -m "Copies /branches/your_branch to /trunk"

If you use a SVN server replace file:///repos with svn://svn.domain.com/repos

$ svn copy svn://svn.domain.com/www.project.nl/trunk svn://svn.cartel.local/www.project.nl/tag/old_trunk -m "copied old trunk as tag"
$ svn del svn://svn.domain.com/www.project.nl/trunk -m "Temporarily deleted trunk."
$ svn copy svn://svn.domain.com/www.project.nl/branches/1.0 svn://svn.cartel.local/www.project.nl/trunk -m "Copied /branches/1.0 to /trunk"

Leave a Reply