Getting started with Subversion

Posted on December 19, 2007. Filed under: Version Control | Tags: , , , , , , , , , |

I’ve been using Subversion (“SVN”) for a year or two now and the other team members are starting to get interested about version control. Once you figure everything out and know what you are doing, Subversion is a breeze. Getting to that point can take a little while. This post will explain now to get started. To learn more about revision control software in general check out this Wikipedia article.

Subversion can be used from either the command line or from a GUI. Most users don’t need to used the more advanced features and should use a GUI. I suggest TortoiseSVN, the most popular Subversion interface for Windows. Subversion comes with TortoiseSVN, so all we need to install is TortoiseSVN.

Start by grabbing the latest version and installing it. I use the default installation settings. You may need to restart after installation.

Now that Subversion and TortoiseSVN are installed we can create a new repository. This will be the location that the Subversion database, which will contain the version information for our files, will be stored. I suggest somewhere that is secure and that you are sure you won’t accidentally delete. I’m going to use C:\SVNRepository. If you plan to have multiple people using your repository, use a location on a network share.

So now we’ve created the SVNRepository directory and are ready to actually create the repository. Make sure the directory is empty. While navigated to the folder, right click and select “TortoiseSVN >> Create Repository Here…”.


You’ll be asked to select the type of repository you want to create – “Native filesystem (FSFS)” or “Berkeley database (BDB)”. I always choose FSFS, but you can use BDB if you wish. If you are creating the repository on a network share, you MUST choose FSFS, for magical reasons.

After you select the repository type you should get a message saying that the repository was successfully created. You’ll now see a few folders and directories in the repository folder you selected. Don’t mess with them unless you know what you are doing. I don’t know what I’m doing, so I don’t mess with them.

Your repository is currently empty, so you’ll need to find some files to put in it. I’ll just use a singe blank text file for now, but you can use anything you wish. In my case, this would usually be a directory containing a Visual Studio project or a web site. Navigate to the folder you want to import, right click, and select “TortoiseSVN >> Import…”.

Folder Import

We’ll have to point Subversion to the repository we created earlier, and we can add an optional note.


After you click “OK”, you should see a log of what was done. This screen tells us that “Some File.txt” was successfully added to the repository, and it is at revision 1.


This part is confusing. Now that the folder is in the repository it can be checked out so that you can edit it. Whenever you edit the files you should be editing them in a “Working copy” of the repository. Although we have imported our folder into the repository, we don’t yet have a working copy! I’m going to create a new directory called “My Working Copy”, and then use “SVN Checkout…” from the right-click menu.


One again navigate to your repository, and click OK. You should get a screen showing a log of the checkout, but I’m not displaying it here.


The “My Working Copy” directory now contains “Some File.txt” along with a hidden folder called “_svn”. The “_svn” folder keeps track of the working copy, so make sure you don’t delete or edit it. Once you are sure your files were checked out properly, you can go ahead and delete the originals. (Note: You should probably back them up first, in case the repository gets corrupted.)

We are almost there. Let’s open up the “Some File.txt” in your working copy and add a line of text to it. I added the line “This is a new line of text.” and then saved the file. I’ve also added a new file called “New File.txt” to m working copy directory.

Lets say that we’ve made a few changes to our file and now want to commit our changes to the repository. Committing our changes will make a point-in-time backup and it will also allow others using the repository with their own working copies to stay up to date by running the “SVN Update” function after we do a commit.

I’ve clicked “SVN Commit” from the right-click menu, and now I can add another comment. In this screenshot I’ve also right-clicked on “New File.txt” and clicked “Add” to that Subversion starts keeping track of the file. You should do the same after deleting files by right clicking on them in the commit window and clicking Delete. Only the files that are checked will be committed. After we click OK, we’ll once again get a log of what was done.


That should be enough to get you going with Subversion!

A few extra notes:

  • You can check out as many working copies as you like. Put each one its own directory and run “SVN Update” before editing each copy. This will make sure that the copy you are editing is up-to-date. Also, run “SVN Commit” after you are done editing each copy to make sure that your other working copies will get the most current version when you update them.
  • If you need to get a non-working copy, say to upload a web site to a production server without all of the “_svn” files use “TortoiseSVN >> Export…”. This will place a clean up-to-date revision of your repository in the folder you choose.

4 Responses to “Getting started with Subversion”

RSS Feed for Mike In Madison Comments RSS Feed

[…] Getting started with Subversion […]

How do I import from Tortise in Eclipse?

This is EXACTLY what I needed to read in order to properly get started with Subversion. Thank you Mike!


Comments are closed.

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: