CVS Command Line Reference

a part of MarkD's Guide to CVS
CVS has an enormous number of commands and options available. The stuff here are mainly commands that I've used on a regular basis.

The general format of CVS commands is:

% cvs general-options command-name command-specific-options filename

Here's how to get help:
cvs --help-commands
Show all of the commands
cvs --help-options
Shows the "global" options, which apply to all commands. The most useful of these is -n, which doesn't execute anything that will change files stored on the disk, but shows what work it would have done.
cvs -H command
Show the command-specific options.

Task Reference

Action How to do it.
Sync your tree with the repository.
See what files are modified or haven't been checked in
cvs update
(sample)
See complete revision history for a file
cvs log filename
(sample)
See revision comment for one revision
cvs log -r1.5 filename
See the differences between a file and its last checked in version
cvs diff filename
See the differneces between two checked-in revisions of a file
cvs diff -r1.4 -r1.7 filename
(sample)
See who modified each line of a file, with what revision
cvs annotate filename
(sample)

This is handy when you see a line of really bogus code and you want to know who was reponsible.

Add a new file to the repository Create the file
cvs add filename
cvs commit -m "Initial Revision" filename
Add a new binary file to the repository Create the file
cvs add -kb filename
cvs commit -m "Initial Revision" filename

A "binary file" won't have CVS keyword expansion performed on it.

Add a new directory to the project cd to the directory's parent cvs add directoryname
Checking a file's changes into the repository.
cvs commit -m "check-in comment" filename
If your check-in comment is more than one line, leave off the the -m option and use the editor that is brought up.
Revert a file to its last checked-in revision Remove the file
cvs update filename
Add a whole directory tree as a new project cdto the project directory
cvs import -m "project name" directory "ArsDigita" "initial-development"

Note that this does not change directory into a CVS-controlled tree. You'll need to remove the tree and check it out.

Check out a whole project
cvs checkout project-name
Label a tree for concurrent development cd to the parent directory of your tree
cvs tag -R -b labelname

This will use the currently-checked-out versions of the files as they exist in your directory tree.

The -b argument means that this tag is a "branch" tag, meaning that someone can check out a new tree based on this tag and do development.

If you omit the -b, the label will be a "sticky" tag, meaning that someone won't be able to check in new changes under that label. See the notes on Labeling and Branching

Check out a tree based on a label
cvs checkout -r labelname projectname
If labelname was created as a "branch" tag, then you can check in changes without affecting anyone using the development tip.

Otherwise files are considered "sticky" and changes cannot be checked in.

Change a file to be treated as a binary file after it's been added cvs admin -kb filename

A "binary file" won't have CVS keyword expansion performed on it.


markd@badgertronics.com
$Id: command-line.html,v 1.3 2000/10/04 21:09:13 markd Exp $