Subversion tutorial

From CDOT Wiki
Jump to: navigation, search


Subversion is a pretty advanced version control system but luckily there is little you need to know to get started.

First you check out your repository using 'svn checkout', you only do this once per client computer.

The two most used commands are 'svn update' and 'svn commit'. An update will take whatever stuff is on the server and copy it to your local copy. A commit will do the reverse of update, take whatever changes in your local copy and copy them to the server. Kind of like FTP but easier to use.

The following examples assume your repository is called 'stuff'. So you did 'svn checkout svn://' and now there is a 'stuff' folder on your machine.

If you just put new files into the 'stuff' folder and then do a commit, nothing will happen. This is because you have to tell subversion explicitly you want those files to be added to the repository. For this you need the 'svn add' command. It's pretty straight-forward, to add a new file 'new.txt' you do 'svn add new.txt'. Now after you do a commit new.txt will be on the server.

There is also 'svn delete'. Though not used as much, you'll probably find it handy when you're playing with your repository trying to learn. Just as simply copying files to 'stuff' doesn't add them automatically to the repository, deleting files from 'stuff' doesn't delete them in a repository. In fact if you simply delete a versioned file and then do an 'svn update' the file will come back. To assure svn you really want to delete the file, let's say 'todelete.txt', do 'svn delete todelete.txt'. After a commit the file will be gone in the repository also.

You should have your svn accounts on cdot by now. If you have a linux box, install the subversion client (usually called svn) and using the commands above you're ready to go.


If you're a windows user, you're in luck this time. There is a brilliant subverion client for windows called Tortoise. Get it from

It is tightly integrated with the windows explorer. You can do all the commands in the General section but without all the typing :)

Once you install it create a new directory for you repository, right-click on it, click 'SVN checkout' and put in the address of you repository on cdot. Commit, add and delete all have right-click menu items.


While on large projects the purpose of a version control system is to control versions, you won't need anything nearly so advanced. For smaller projects the main strength of subversion is the ability to easily keep files on multiple computers up to date. That's your desktop, your laptop, and your team members' computers.

I recommend you avoid editing the same files on more then one machine at a time, regardless of what Dave sais. If you have a conflict, it will give you unneccessary headaches. Take at least a couple of weeks to get used to the simple commands described in this tutorial.