Frequently Useful CVS Commands

cvs add [ -m message ] file ...

Set up new files for incorporation into the module. The actual incorporation, which makes the files available to others, won't take place until you do a subsequent cvs commit. The message switch is incorporated into the logs for the new files; if you don't specify it, cvs will invoke your editor.

cvs checkout [ -r tag ] module

Make a local copy of the module sources in a subdirectory of the same name. These files are your local copies and have no effect on anyone else's ability to get at the sources (cvs provides no file locking mechanism). Without the -r switch, checkout will retrieve the most recent version of the files; with it, the versions of the files associated with the specified tag will be retrieved. Note: any tag you specify is "sticky" -- subsequent checkout, commit, and update commands will affect the tagged version of the sources, not the main branch. To return to working on the main branch, specify -r HEAD.

cvs commit [ -m message ] [ file ... ]

Incorporate into the repository file modifications and the affects of cvs add and cvs remove commands that you've made. As with the add command, if you don't specify a log message as part of the command, cvs will invoke your editor.

cvs diff [ -r tag [ -r tag ] ] [file ...]

Display differences between the repository and working directory versions of the specified files, or all files if no file list is given. Compares your copy of the file(s) against the current repository version if no -r switch is included. With one -r switch, compares your copy against the specified version; with two, compares the two specified versions.

cvs import module tag tag

Add the tree of files based on your current working directory to your cvs repository under the name module. cvs requires that you specify the two tags (vendor and release tag names), but you will probably never need to use them.

cvs log [ -r tag ] [file ...]

Display the log messages entered when the specified revision of the listed files were committed. Displays all log messages associated with the listed files if no -r switch is included. Displays log messages for all files in the module if no list of files is included.

cvs remove file ...

Schedule file for removal from the repository. The file won't actually be removed until you do a subsequent cvs commit. You must first delete the file from your working directory before executing this command. Files removed from the repository are moved to a special subdirectory (called "Attic"), and so may be recovered if necessary.

cvs rtag -b [ -F ] tag module

Mark the current versions of repository files with the identifier tag. This tag may subsequently be used when checking out sources to get the tagged versions, regardless of any changes that have been made in the meantime. cvs normally refuses to use the same tag on a file twice, but the -F switch may be used to delete an existing tag and move it to the current version.

cvs update -d [ file ... ]

Incorporate any modifications (changes, additions, and deletions) that other folks have made to the repository files into your working sources. cvs will incorporate repository changes even in files which you've modified, as long as the two sets of changes don't conflict. In case of a collision (e.g., the same line of source has been changed in both the repository and your local copy), cvs merges and annotates the changes and leaves an untouched copy of your version in a file, named .#file.version, in your directory.

In addition to the command options listed above, there are a couple of options to cvs itself, specified between cvs and the command name, that might occasionally prove useful:

-d path

Search path for the repository, rather than using the CVSROOT environment variable.

-n

Show the effects of performing the command without actually doing it.