Simple Subversion (SVN) Tutorial for Linux

There are many Subversion tutorials on the web but none that clearly list the steps I need for my set-up.

For this example, I am developing a web site in a working directory on my test server, where the repository also resides.

Assuming that subversion has been installed, here is what I do to create the repository, import the files and checkout to the server.

# create repository
mkdir -p /var/svn/project_name
svnadmin create /var/svn/project_name
# create trunk, branch and tags directories
mkdir /var/svn/project_name/trunk /var/svn/project_name/branch /var/svn/project_name/tags
#import files. The files will go into the trunk directory, which is reserved for the stable version.
svn import /var/www/public_html.import/ file:///var/svn/project_name/trunk/ -m "Initial Import"
# checkout the repository to the server. This will copy the tree under trunk to the public_html directory
svn checkout file:///var/svn/project_name/trunk public_html

To update the working copy enter the root of the working copy and run:

svn update

To commit changes to the repository, enter the root of the working copy and run:

svn commit

If you prefer a GUI interface over using the Linux command line, there is a Linux tool called RabbitVCS that integrates with the Nautilus file manager.