At work we opted to ignore what all instructions said and set our Subversion repositories up without the traditional trunk, branches, tags structure. Even worse was that what was effectively our trunk was the root of the repository. Well we now decide our project is getting very large and want to do some branching and other things. My first idea, which I am a bit embarrassed to confess is to create a totally separate repository from branches. Okay that’s a stupid idea, so here is what I did, you may find some of it helpful.

Here is the process I did:

first I created a new repository called “project_new”


	> svnadmin create /path/to/project_new

then dump the old repository


	> svnadmin dump /path/to/old_project_root > ~/project.dumpfile

import it into the new repository


	> svnadmin load /path/to/project_new < ~/project.dumpfile

note: all the above steps are just so that I could test out the new one, before switching my live sites over

checkout a copy of project_new make a trunk directory and move everything into it, then make branches and tags if you want


	> svn checkout file:///path/to/project_new
	> cd project_new
	> svn mkdir trunk
	> ls
	> random_folder		trunk
	> svn mv random_folder trunk/.
	> svn commit -m "moved everything into the trunk"

after testing this out I replaced the old repository with this new one


	> mv /path/to/old_project_root ~/old_project_backup
	> mv /path/to/project_new /path/to/old_project_root

now one last thing which is very important to make sure your working copies stay the same. If you don’t do this it will add trunk to your working copy, delete all files and add them to trunk


	> svn switch file:///path/to/old_project_root/trunk

Another thing I learned while doing all this is

If you are changing repositories, like when I wanted to change from old_project_root project_new for testing you have to do


	svn switch --revision file:///path/to/old_project_root file:///path/to/project_new

!!! Don’t do an update yet, you need to point to trunk


	> svn switch file:///path/to/project_new/trunk