Concurrent Versions System (CVS)


CVS is a revision control system that we use to manage our locally-developed software as well as some systems files that are often edited by more than one staff person. CVS eliminates the problems related to write collisions as well as adds some nice additional features.

Initialize the Repository

If you are setting up the CVS repository from scratch yourself, you will need to run the following command (once) to do the initialization. If you are using a CVS repository that had already been set up by someone else you do not need to do this.

% cvs -d /projects/labbies/CVS init

The pathname shown here is just an example, and will be used for all the examples shown on this page. Use the pathname to where your CVS repository should be instead of the example pathname.

How to Use CVS


Set the CVSROOT environment variable to point to the repository containing your CVS-managed data:

% setenv CVSROOT /projects/labbies/CVS

Checkout Files

Each major project is entered as a module. By doing this, we can get a list of the contents of the repository by simply looking at the modules list. How to get to the modules list involves checking out a special module called CVSROOT. That project contains all of the CVS config files. To check out any module, you use the cvs checkout command. To check out CVSROOT:

% cvs checkout CVSROOT

It will create a directory called CVSROOT/, which will contain a bunch of files. The one called modules is the one that we're concerned with.

Once you know what module you want to check out, you can just use the cvs checkout command to pull what you want.

Refresh Checked-Out Files

Other people can check out their own copies of the project files and make changes to them. Once they have commited those changes to the repository, you have the ability to incorporate them into your checked out files using the cvs update command. This automatically patches the files as needed. If your edits and the repository changes collide it will tell you, mark up the areas of conflict, and you are able to manually edit the file and resolve the problem.

Edit Files

Once you have checked out a copy of a project/module, it is yours to do with as you want. You can make whatever changes you like to the files, and it will not impact anyone else. Once you have applied changes and want to make them visible to others, you can use the cvs commit command to load them into the repository. If there are any conflicts during the commit, it will not commit the files in question and you need to run cvs update to resolve them.

Add New Files

Use cvs add to add new files.

lethe {~/devel/support} > cvs add
cvs add: scheduling file `' for addition
cvs add: use 'cvs commit' to add this file permanently
lethe {~/devel/support} > cvs commit

Remove Files

First delete the files from your project directory, then run the cvs remove command to put them into the "attic" in the repository. They will be recoverable, but will not be checked out by default for any future checkouts.

Remote Access

For "Unix like" systems that come with CVS commands and SSH it is possible to access the repository from remote machines. A command "alias" can be set up that makes that easier. An example that sets up an alias named "lcvs" might be:

% alias lcvs "env CVS_RSH=ssh cvs -d"

Replace "user" with your username. With that alias on a remote machine you can do:

% lcvs checkout module

You will be asked for your password on hadar, and the CVS repository will be accessed remotely using SSH.


  1. TortoiseCVS is a good free Windows CVS client.