What is the best way to make one of the branches of a subversion repository the new trunk?
There has been a major rewrite for the entire system: t
I was just looking at this problem recently, and the solution that I was very happy with was performing
svn merge --ignore-ancestry trunk-url branch-url
on the working copy of my trunk.
This does not try to apply changes in a historical manner (maintaining changes in the trunk). It simply "applies the diff" between the trunk and the branch. This will not create any conflicts for your users in the files that were not modified. You will however lose your Historical information from the branch, but that happens when you peform a merge anyway.
While the answers above will work, they aren't best practice. The latest svn server and client track merges for you. So svn knows which revisions you've merged into a branch and from where. This helps a lot when keeping a branch up-to-date and then merging it back into the trunk.
No matter which version of Subversion you're using however, there is a best practice method for getting changes in a branch back into trunk. It is outlined in the Subversion manual: Version Control with Subversion, Chapter 4. Branching and Merging, Keeping a Branch in Sync.
It is a really weird/unusual configuration in SVN, even I think it is far from being a "good practice" at all, anyway, I guess you could do something like:
Good luck
I agree with using the svn move command to accomplish this goal.
I know others here think its unusual, but I like to do it this way. When I have a feature branch and am ready to merge it with a trunk that has also be significantly modified, I will merge it to a new branch, usually named <FeatureBranchName>-Merged
. Then I resolve conflicts and test the merged code. Once that's complete I move the trunk to the tags folder so I don't lose anything. Lastly I move my <FeatureBranchName>-Merged
to the trunk.
In addition I prefer to avoid the working copy when doing the moves, here are samples of the commands:
svn move https://SVNUrl/svn/Repo/trunk https://SVNUrl/svn/Repo/tags/AnyName
svn move https://SVNUrl/svn/Repo/branches/BranchName-Merged https://SVNUrl/svn/Repo/trunk
Note: I use 1.5
Use svn move to move the contents of the old trunk somewhere else and rename the branch to trunk afterward.
Note that copy and move in svn work like file operations. You can use them to move/copy stuff around in your repository and these changes are versioned as well. Think of "move" as "copy+delete".
[EDIT] Nilbus just notified me that you will get merge conflicts when you use svn move
.
I still think that this is the correct approach. It will cause conflicts but if you merge carefully, chances are that you won't lose any data. If that bothers you, use a better VCS like Mercurial or Git.
Recommend you do these changes via the repository browser tool.
Attempting large delete+move operations via the working copy is a great way to kill the working copy. If you are forced to use the working copy, perform incremental commits after each delete or move operation and UPDATE your working copy after each commit.