Using CVS in the CSUGLab
CVS is a revision control system that makes it easier for several people to work simultaneously on a software project while maintaining their own separate working areas. This page describes the basic commands that you need to know to start using CVS.
Your changes to the source code are only distributed to other users when you explicitly commit your code using the "cvs commit" command. Changes made by other users are only seen by you when you explicitly request them via a "cvs update" command. CVS has many other useful features. See the CVS manual pages for a detailed description of how to use it.
Command Line Execution
This document is a quick introduction to using CVS from the command line, by running the cvs executable program. There are many tools and programming environments (such as Eclipse, for instance) that have built-in support and user-friendly interfaces for CVS. These tools and interfaces are not discussed here.
On Linux machines, or using Cygwin in Windows, you should be able to type "
cvs" in the shell/Cygwin window. You will need to set up a CVS repository to hold your code; the CSUGLab admins can do this for you, as described below. This document also provides a quick tour of the main CVS commands.
CVS repositories are available to students with CS Undergraduate Lab (CSUGLab) accounts for use in a course or project. The main repository is set up on a host named cvs.csuglab.cornell.edu in the
To request such a repository, please send email to Tanya Gupta (email@example.com) including the names and netids of your group members. The subject of the mail should be "CS 3110: CVS repository request". Your repository will only be stored until the end of the current semester. For more information on setting up CVS, see the CSUGLab CVS page.
You can access the repository either locally or remotely:
Local access: log on to cvs.csuglab.cornell.edu and run cvs command using:
cvs -d :local:/cvsroot
Remote access: set your CVS_RSH environment variable to "
ssh" and then run cvs commands using
cvs -d :ext:<your_userid>@cvs.csuglab.cornell.edu:/cvsroot
Note: you can avoid specifying the "-d" argument in two ways:
by setting the environment variable CVSROOT to the appropriate value (
by running the commands from one of the sub-directories in your local work directory (i.e., a directory that contains a
Note for Windows users: to set up environment variables in Windows, right click on the My Computer icon and choose Properties. Select the tab labeled Environment. You can also go to the Control Panel > system > advanced tab > environment variables. Under cygwin, you can set environment variables in your
.bashrcfile, e.g. CVS_RSH=ssh.
Setting up work directories
After the repository has been created, all group members should create working directories to house the files checked out of the repository. For each user, set up the environment variables specified in the 'Setting up environment variables' section. Then, execute the following command from a shell prompt (cygwin or a unix shell):
cvs checkout <project name>
<project name>is the name of the project specified when creating the repository. This command will create a directory with the name
<project name>and containing all files and subdirectories contained in the project.
To check out all of the files in the repository, execute:
cvs -d :ext:<your_netid>@cvs.csuglab.cornell.edu:/cvsroot checkout <repository>
To obtain the latest version of a file, execute :
cvs update <filename>
Note1: You may find it convenient to update multiple files at once. For this, go to a subdirectory, and type "
cvs update". All files in that directory and its subdirectories will get updated.
Note2: If new directories have been created since the last time you did an update, those directories will not get retrieved by "
cvs update". To force updating new subdirectories, use "
cvs update -d".
To put a modified file in the repository, execute :
Note1: If you omit the
cvs commit -m "<comment>" <filename>
-m "<comment>"argument, CVS will ask you to open an editor and enter a message for your changes.
Note2: You may find it convenient to commit multiple files at once. For this, go to a subdirectory, and type "
cvs commit". All files in that directory and its subdirectories will get committed.
To add a new file (or directory) to the repository, execute :
cvs add <filename>
Note : You must commit the file after adding it before other group members can check it out.
To remove a file from the repository, execute :
cvs remove <filename>
Note : You must commit the file before it is actually removed.
To view the differences between a file in the working directory and the repository, execute :
cvs diff <filename>
Several commands (e.g., checkout, update, and diff) support an argument "-D <some date>" to perform the specified operation against an older version of the code. This feature is very useful when you want to resort to an older version when the current one appears to have problems. CVS supports a variety of different ways for expressing dates. Here some examples:
cvs checkout -D "2 hours ago"
cvs checkout -D "yesterday"
cvs checkout -D "9/22/06"
cvs checkout -D "9/22/06 10:00am"
See the on-line documentation for further information on using CVS.