Subversion Primer

This is a guide for a single user to setup a barebones SVN repository quickly and without any extra confusing instructions.

The following steps will show how to 1.setup a repository for a project, 2. import files into the repo, 3. pull them out into a different folder, and 4. submit changes back to the repo. Before starting, make sure you have subversion installed (sudo apt-get install subversion) on all the computers you will be using. For this howto I’ll be using the server “closetbox” and the client “icebox”. Both are running Ubuntu Linux.

  1. Create an SVN repository for a project on the server.

nick@closetbox:# sudo mkdir /var/svn
nick@closetbox:# sudo svnadmin create /var/svn/frozenindustries
nick@closetbox:# sudo chmod 770 /var/svn/frozenindustries
nick@closetbox:# sudo chown nick:nick /var/svn/frozenindustries

  1. Import files into the repository. I’m going to send over a wordpress blog which is sitting in a folder called “htdocs” on my desktop. This is only done once, after this files are updated using “ci”.

nick@icebox:# svn import -m “look, i’m importing” htdocs/ svn+ssh://closetbox/var/svn/frozenindustries/trunk

  1. Get your data back out of SVN an put it in a folder on the client where you’ll work on it.

nick@icebox:# svn co svn+ssh://closetbox/var/svn/frozenindustries/trunk fi/

  1. After making changes to files in fi, send the changes back to the server. SVN knows which server you checked out from by saving data in a .svn folder. It’ll pop open your default text editor to show the changes. Since we’re trying to be as simple as possible, just assume everything is correct, quit the text editor, and say “c)ontinue”

nick@icebox:# svn ci fi/

That’s it. Repeat steps 3 and 4 to grab copies of you project and submit changes.