This page gives a short introduction on how to use the Concurrent Versioning System (CVS). For further documentation, refer to the CVS manual via
CVS is a tool that helps developers to
- work on a set of files in parallel and
- to archive old versions of the files
To do this, CVS maintains a repository that keeps the files and all the necessary information. The repository is typically a subdirectory called <somedir>/cvsroot. Do not modify, delete or copy the files in this subdirectory directly! In the following, it is assumed that the subdirectory is locally accessible. However, it is also possible to access a CVS repository remotely.
Checking out a module
Inside the repository, CVS keeps a number of modules. A module can contain files and subdirectories. Think of a module as a subdirectory.
To be able to work with the files, you need to check out the module into a working directory. The command for this is relatively long and complicated, however, this needs to be done only once. Afterwards, you can work with the files via much simpler commands! The command is
cvs -d <cvsroot> checkout [-d <workdir>] <module>
- <cvsroot> is the path to the repository, e.g. /usr/local/cvsroot
- <workdir> is the name of the working directory that will be created and that contains the files after checkout. If you leave out this option, the name of the module will be used. To check out the files into the local directory, use -d ..
- <module> is the name of the module
When the command is executed, a subdirectory workdir will be created and all the files and subirs that belong to the module will be put into the directory.
Checking the status of the working directory
The contents of the repository will change, as other people will probably work on the same files. Therefore it is useful to be able to check whether any of the files has changed. To do this, you can use
cvs -n update
This will return a list of files and a one-character code in front of it, e.g.
? config.h M fft.c
The one-character codes tell the following:
- The file is not in the repository.
- The file is modified in your working directory.
- The file is modified in the repository and needs to be updated (cvs update).
- The file has been added to CVS. Call cvs commit to actually commit the file.
- The file has been removed from CVS. Call cvs commit to actually delete the file from the repository.
- There will be a conflict when the files are merged.
Bringing the working directory up-to-date
When you notice that something has changed, you should update your copy of the files. To do this, use
This will incorporate all the changes that have been done to the files in the repository since you last updated them. If you should have changed any of the files that had to be updated, your changes will not be overwritten, but they will be merged into a new version. Usually this works without your intervention, but sometimes a conflict arises. When this happens, CVS will tell you about it and you will have to manually merge the files. Refere to the manual for details.
Now you can start to do with the files whatever you want. Add some program code, delete some, modify some text, etc. Whenever you want other people to be able to get the changes that you have done, you need to commit the changes to the repository. To do this, simply call
This will compare all the files to the files in the repository, and if a file has changed, it will ask you to give a log message about what you have changed. These messages can be read later on.
Adding and removing files
The working directory may contain files that are not kept in the repository (e.g. compiled programs). Therefore, not every file in your working directory is automatically added to CVS. If you want to add a file to the repository, call
cvs add <file>
When you want to remove a file from the repository, use
cvs remove <file>
In both cases, to have the changes come into effect, you need to call cvs commit afterwards.