Subversion is an alternative to CVS that is growing in popularity. Installing Subversion Users of Debian and Debian-based distributions (like Ubuntu) just need to issue the following command: Code: apt-get install subversion subversion-tools Subversion packages are also included in Red Hat's Fedora Core distribution. If you have the 'yum' package management system installed, you can install subversion by issuing the command: Code: yum install subversion There, of course, also exists the possibility of installing from source. Creating a Repository First, I created a directory called 'dev' in /home/mike where I am going to keep the repositories for projects I work on. Essentially, what happens is that you have a directory where you're working and a directory where the repository stores that work for version control purposes. These are, of course, separate. Let's say you've been offered a project to design a website for a restaurant called Larry's Clam Shack. If you want to use subversion for version control on the project, you need to first create a repository. To do this, issue the following command: Code: svnadmin create /home/mike/dev/clamshack Once created, the directory structure will look like this: Code: drwxr-xr-x 2 mike mike 4096 2005-09-14 17:29 conf drwxr-xr-x 2 mike mike 4096 2005-09-14 17:29 dav drwxr-sr-x 2 mike mike 4096 2005-09-14 17:29 db -r--r--r-- 1 mike mike 2 2005-09-14 17:29 format drwxr-xr-x 2 mike mike 4096 2005-09-14 17:29 hooks drwxr-xr-x 2 mike mike 4096 2005-09-14 17:29 locks -rw-r--r-- 1 mike mike 379 2005-09-14 17:29 README.txt According to the developers, it's a good idea to set up your directory structure for optimum use of subversion. First, create a temporary directory (call it 'tmp' if you want) Then create this directory structure inside of 'tmp': Code: mkdir larrycs mkdir larrycs/trunk mkdir larrycs/branches mkdir larrycs/tags Now what we'll do is import this layout tree into the subversion repository 'dev': Code: svn import . file:///home/mike/dev/clamshack --message 'creating clam shack repository' You'll see a message like this: Code: Adding larrycs Adding larrycs/trunk Adding larrycs/branches Adding larrycs/tags Committed revision 1. You can verify that it got created by issuing the command: Code: svn list --verbose file:///home/mike/dev/clamshack Feel free to remove 'tmp'. I did, anyway, because I get confused easily. I'm actually going to do my work in a directory which will get me the prize for originality: 'work' Now that you're ready to start using the repository. You need to go to the directory that corresponds to 'work' and \"checkout\" the repository. Once you're in your work directory, issue the following command: Code: svn checkout file:///home/mike/dev/clamshack You should see the following: Code: drwxr-xr-x 3 mike mike 4096 2005-09-13 18:51 branches drwxr-xr-x 3 mike mike 4096 2005-09-13 18:51 tags drwxr-xr-x 4 mike mike 4096 2005-09-13 18:59 trunk Working With Subversion Now that you've got your work area set up, you are free to add files. If you look inside the directory that the checkout created, you'll find the layout we set up for subversion: Code: drwxr-xr-x 3 mike mike 4096 2005-09-13 18:51 branches drwxr-xr-x 3 mike mike 4096 2005-09-13 18:51 tags drwxr-xr-x 4 mike mike 4096 2005-09-13 18:59 trunk It's in the 'trunk' directory where we'll be storing out files. For example, I first created a directory to save the documentation for the project then I added it to the repository: Code: svn add docs/ Then we would commit it to the repository. Doing a 'commit' is like saying: "Yes, I really want this in there". Code: svn commit -m "docs dir" docs/ In the docs/ directory, I created a file called 'notes' where I will jot down things that I have to remember about the project. After creating the first entry, I added it as well: Code: svn add notes And then I committed it: Code: svn commit -m "notes file" notes I assume you're getting the idea here. You can leave off the -m \"message here\" part and your default text editor will pop up and ask you to write the message there. I prefer to save a step, so I don't do it. If you do have some lengthy message to write, it might be a better idea to leave it off and use the text editor. As you're working on your project, and you want to see what changes you've been making, you can issue the following command to see that: Code: svn log notes If you're hard at work on your work copy and you want to look at the differences between what you've got and what you started with, you can issue a diff command: Code: svn diff notes If you find that you're changes aren't what you really wanted, you can convert (or revert) back to the repository's copy with: Code: svn revert notes Advantages to Using Subversion Since subversion was meant to be a substitute for CVS, its advantages are essentially fixes of what was lacking in CVS. For example, aborted commit actions in CVS sometimes result in the corruption of the repository. This doesn't happen with subversion. There is also better support for retaining version and history information of files when they are moved or renamed. It has also better built-in binary file support than CVS. At any rate, whether you use CVS or subversion, there's no debate about the importance of some version control system for a programmer.