Friday, 21 October 2011

How to import existing code to svn with visualsvn and tortoisesvn

You might have some code which is not under version control, and it is mixed with binaries or other files that you don't really want in the svn repository. If the code in question contains both files that should be and should not be versioned, the easiest way to do it is this:

1. In visualsvn create a new repository, with the name of the project you want to version, let's say the new repository name is MyProject

2. Rename the folder containing the source code you want to version, let's say is called MyProject, we rename it to MyProject-

3. Create a new folder with the same name as the one you just renamed: MyProject

4. Using tortoise svn do an svn checkout from repository MyProject into the new empty folder MyProject you have just created

5. Move all the files from the renamed folder MyProject- into the new folder MyProject

6. Using tortoise svn do an "add" operation on the new folder MyProject, and choose the files you want to include in svn (probably you will avoid the binaries, object files and other stuff that you don't want versioned)

7. Using tortoise svn do a commit of the newly added files/folders into svn repository

8. Delete the renamed folder MyProject- as it is not needed any more

Monday, 30 May 2011