Terry Thibodeau's Blog

Welcome to Terry Thibodeau's Blog Sign in | Join | Help

TortoiseSVN - import an existing file structure

Recently, I've been using Subversion as a versioned backup system for a couple of my "settings" folders (an upcoming blog post has an awesome example of this...stay tuned). In this post, I'm going to show you how to import an existing folder structure into Subversion while keeping it as your working folder as well.

Bad way

If you've ever used TortoiseSVN to add an existing folder structure into Subversion, you may have done it like so:

Import into SVN
  1. Right-click the folder you wish to add to version control
  2. Choose "Import" from the TortoiseSVN menu
  3. Choose the repository
  4. Wait for the data to upload

We now have the folder in our repository. But what about versioning local changes made to this structure? Well, you have to get a working copy from Subversion. Since we already have an existing folder with all of the files, we can't do a Checkout in the same place (which is what we want to do) or TortoiseSVN complains. What can we do? Well, we could delete that folder and Checkout.

However, it's not very efficient to upload the entire directory structure to SVN, just to turn around and download the very same data we already have! Here's the solution:

Good way

  1. Right-click any folder and choose "Repo-browser" from the TortoiseSVN menu
  2. In the repository, create a folder of the same name as the root of the folder that you wish to import (in the appropriate repo path where you'd like the folder to live)
    Create SVN repository folder
  3. Right-click the root folder that you wish to add to SVN and choose "Checkout" from the TortoiseSVN menu
  4. Choose the path to the newly created, empty folder in the repository, click OK
    SVN Checkout
  5. Now that you have a working SVN copy, you can right-click the root folder and choose "Add" from the TortoiseSVN menu. Select all the subfolders and files
  6. Commit (you could also have chosen Commit instead of Add and then added the files from the Commit dialog)

You now have a local, SVN working copy, imported into Subversion, without having to upload AND then download the same data!

Published Monday, January 28, 2008 4:42 PM by Terry Thibodeau
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Terry Thibodeau's Blog said:

Those who know me know that I hate repetition. Reducing duplication and improving productivity is usually

May 6, 2008 1:21 PM
 

Eric said:

Nice tip!  I had to read it 3 times to get it but I got it...I will try this next time I add a new folder to the repo.

May 7, 2008 5:11 PM
 

Pete said:

Thanks... very useful!

February 5, 2009 3:23 PM
 

omar said:

I get lost from step 1 to 2. because in the reposity browser window there is not an option to create a folder, can you explain this step?

July 28, 2009 3:40 PM
 

Terry Thibodeau said:

Right-click pretty much anywhere in the folder structure and you'll see the menu item for Create Folder

September 18, 2009 1:47 AM

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems