Version Control using Subversion (SVN)

The code for my projects has been getting ever more complex. Add to that the fact that I’m now using multiple computers for development and I find I have a need for a version control system.

I have had experience checking out projects on both CVS and SVN control systems but have never made commits or maintained the system myself. Luckily there are some good guides out there and Ubuntu has everything I need in the repositories to get my chosen package system, Subversion, up and running.

Tutorials
I used parts from both of these tutorials:

Installation

I did not install or setup the web interface system. Right now I’m trying everything out using my local network so installing the subversion ubuntu package is all I really needed.

I followed the Community Documentation’s guidelines to create a directory at /home/svn and to add the group “subversion” making myself and www-data members of that group.

Commands
Create the project:

sudo svnadmin create /home/svn/myproject

Import the first version of the code you have written. This will import all files in the DIR_TO_IMPORT:

svn --username YOUR_USERNAME import DIR_TO_IMPORT file://YOUR_LAN_ADDRESS/home/svn/myproject -m "First file import"

Check Out the first revision of the code. You want to make sure to check out from SVN now instead of working from what you just imported. This will make committing your changes easy.

svn co file://YOUR_LAN_ADDRESS/home/svn/myproject

note: these command should be run from the working directory.
Commit changes you have made to the repository:

svn commit

Show the changes you have made since checking out the latest version:

svn diff

Update to the most current version from the repository:

svn update

Leave a Reply