Here is a Reference manual for CVS commands, it's quite long. If you are looking for quick and short command examples, see CVS mostly used command examples


This describes every subcommand of CVS in detail, and how to use CVS.

    Structure ... overall structure of CVS commands
    Global options ... options you give to the left of cvs_command
    Common options ... options you give to the right of cvs_command

    cvs add ... adds a new file/directory to the repository
    cvs admin ... administration front end for rcs
    cvs checkout ... checkout sources for editing
    cvs commit ... checks files into the repository
    cvs diff ... runs diffs between revisions
    cvs export ... export sources from CVS, similar to checkout
    cvs history ... shows status of files and users
    cvs import ... import sources into CVS, using vendor branches
    cvs log ... prints out 'rlog' information for files
    cvs rdiff ... 'patch' format diffs between releases
    cvs release ... indicate that a Module is no longer in use
    cvs remove ... removes an entry from the repository
    cvs rtag ... add a tag to a module
    cvs status ... status info on the revisions
    cvs tag ... add a tag to checked out version
    cvs update ... brings work tree in sync with repository


Overall structure of CVS commands

The first release of CVS consisted of a number of shell-scripts. Today CVS is implemented as a single program that is a front-end to RCS and diff.

The overall format of all CVS commands is:

cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
cvs
    The program that is a front-end to RCS.
cvs_options
    Some options that affect all sub-commands of CVS. These are described below.
cvs_command
    One of several different sub-commands. Some of the commands have aliases that can be used instead; those aliases are noted in the reference manual for that command. There are only two situations where you may omit cvs_command: cvs -H elicits a list of available commands, and cvs -v displays version information on CVS itself.
command_options
    Options that are specific for the command.
command_args
    Arguments to the commands. 

There is unfortunately some confusion between cvs_options and command_options. For example, -q can often (but not always) be given as both a cvs_option and a command_option. -l, when given as a cvs_option, only affect some of the commands. When it is given as a command_option is has a different meaning, and is accepted by more commands. In other words, do not take the above categorization too seriously. Look at the documentation instead.

Global options

The available cvs_options (that are given to the left of cvs_command) are:

-H
    Display usage information about the specified cvs_command (but do not actually execute the command). If you don't specify a command name, cvs -H displays a summary of all the commands available.
-Q
    Causes the command to be really quiet; the command will only generate output for serious problems.
-q
    Causes the command to be somewhat quiet; informational messages, such as reports of recursion through subdirectories, are suppressed.
-b bindir
    Use bindir as the directory where RCS programs are located. Overrides the setting of the $RCSBIN environment variable and any precompiled directory. This value should be specified as an absolute pathname.
-d cvs_root_directory
    Use cvs_root_directory as the root directory pathname of the repository. Overrides the setting of the $CVSROOT environment variable. This value should be specified as an absolute pathname.
-e editor
    Use editor to enter revision log information. Overrides the setting of the $EDITOR environment variable.
-l
    Do not log the cvs_command in the command history (but execute it anyway). cf. history, for information on command history.
-n
    Do not change any files. Attempt to execute the cvs_command, but only to issue reports; do not remove, update, or merge any existing files, or create any new files.
-t
    Trace program execution; display messages showing the steps of CVS activity. Particularly useful with -n to explore the potential impact of an unfamiliar command.
-r
    Makes new working files files read-only. Same effect as if the $CVSREAD environment variable is set (@pxref{Environment variables}). The default is to make working files writable.
-v
    Displays version and copyright information for CVS.
-w
    Makes new working files read-write. Overrides the setting of the $CVSREAD environment variable. Files are created read-write, unless $CVSROOT is set or -r is given. 

Common command options

This section describes the command_options that are available across several CVS commands. These options are always given to the right of cvs_command. Not all commands support all of these options; each option is only supported for commands where it makes sense. However, when a command has one of these options you can almost always count on the same meaning for the option as in other commands. (Other command options, which are listed with the individual commands, may have different meanings from one CVS command to another).

Warning: the history command is an exception; it supports many options that conflict even with these standard options.

-D date_spec
    Use the most recent revision no later than date_spec. date_spec is a single argument, a date description specifying a date in the past.

    The specification is sticky when you use it to make a private copy of a source file; that is, when you get a working file using -D, CVS records the date you specified, so that further updates in the same directory will use the same date (unless you explicitly override it; cf. update).

    A wide variety of date formats are supported by the underlying RCS facilities, similar to those described in co(1), but not exactly the same. The date_spec is interpreted as being in the local timezone, unless a specific timezone is specified. Examples of valid date specifications include:

                        1 month ago
                        2 hours ago
                        400000 seconds ago
                        last year
                        last Monday
                        yesterday
                        a fortnight ago
                        3/31/92 10:00:07 PST
                        January 23, 1987 10:05pm
                        22:00 GMT

    -D is available with the checkout, diff, export, history, rdiff, rtag, and update commands. (The history uses this option in a slightly different way; cf. history options).

    Remember to quote argument to the -D flag so that your shell doesn't interpret the spaces as argument separators. A command using the -D flag can look like this:

    $ cvs diff -D "1 hour ago" cvs.texinfo

-f
    When you specify a particular date or tag to CVS commands, they normally ignore files that do not contain the tag (or did not exist on the date) that you specified. Use the -f option if you want files retrieved even when there is no match for the tag or date. (The most recent version is used in this situation).

    -f is available with these commands: checkout, export, rdiff, rtag, and update.

    Warning: The commit command also has a -f option, but it has a different meaning in that command. cf. commit options.

-H
    Help; describe the options available for this command. This is the only option supported for all CVS commands.
-k kflag
    Alter the default RCS processing of keywords. @xref{Keyword expansion}, for the meaning of kflag. Your kflag specification is sticky when you use it to create a private copy of a source file; that is, when you use this option with the checkout or update commands, CVS associates your selected kflag with the file, and continues to use it with future update commands on the same file until you specify otherwise.

    The -k option is available with the add, checkout, diff and update commands.

-l
    Local; run only in current working directory, rather than recursing through subdirectories.

    Warning: this is not the same as the overall cvs -l option, which you can specify to the left of a cvs command!

    Available with the following commands: checkout, commit, diff, export, log, remove, rdiff, rtag, status, tag, and update.
-n
    Do not run any checkout/commit/tag program. (A program can be specified to run on each of these activities, in the modules database (@pxref{modules}); this option bypasses it).

    Warning: this is not the same as the overall cvs -n option, which you can specify to the left of a cvs command!

    Available with the checkout, commit, export, and rtag commands.
-m message
    Use message as log information, instead of invoking an editor. Available with the following commands: add, commit and import.
-P
    Prune (remove) directories that are empty after being updated, on checkout, or update. Normally, an empty directory (one that is void of revision-controlled files) is left alone. Specifying -P will cause these directories to be silently removed from your checked-out sources. This does not remove the directory from the repository, only from your checked out copy. Note that this option is implied by the -r or -D options of checkout and export.
-p
    Pipe the files retrieved from the repository to standard output, rather than writing them in the current directory. Available with the checkout and update commands.
-Q
    Causes the command to be really quiet; the command will only generate output for serious problems. Available with the following commands: checkout, import, export, rdiff, rtag, tag, and update.
-q
    Causes the command to be somewhat quiet; informational messages, such as reports of recursion through subdirectories, are suppressed. Available with the following commands: checkout, import, export, rtag, tag, and update.
-r tag
    Use the revision specified by the tag argument instead of the default head revision. As well as arbitrary tags defined with the tag or rtag command, two special tags are always available: HEAD refers to the most recent version available in the repository, and BASE refers to the revision you last checked out into the current working directory.

    The tag specification is sticky when you use this option with checkout or update to make your own copy of a file: CVS remembers the tag and continues to use it on future update commands, until you specify otherwise. The tag can be either a symbolic or numeric tag. @xref{Tags}.

    Specifying the -q option along with the -r option is often useful, to suppress the warning messages when the RCS history file does not contain the specified tag.

    Warning: this is not the same as the overall `cvs -r' option, which you can specify to the left of a cvs command!

    -r is available with the checkout, commit, diff, history, export, rdiff, rtag, and update commands.

cvs add

    Function: Add a new file/directory to the repository.
    Synopsis: add [-k kflag] [-m 'message'] files...
    Requires: repository, working directory.
    Changes: working directory.
    Synonym: new

Use the add command to create a new file or directory in the source repository. The files or directories specified with add must already exist in the current directory (which must have been created with the checkout command). To add a whole new directory hierarchy to the source repository (for example, files received from a third-party vendor), use the import command instead. cf. import.

If the argument to add refers to an immediate sub-directory, the directory is created at the correct place in the source repository, and the necessary CVS administration files are created in your working directory. If the directory already exists in the source repository, add still creates the administration files in your version of the directory. This allows you to use add to add a particular directory to your private sources even if someone else created that directory after your checkout of the sources. You can do the following:

$ mkdir new_directory
$ cvs add new_directory
$ cvs update new_directory

An alternate approach using update might be:

$ cvs update -d new_directory

(To add any available new directories to your working directory, it's probably simpler to use checkout (cf. checkout) or update -d (cf update)).

The added files are not placed in the source repository until you use commit to make the change permanent. Doing an add on a file that was removed with the remove command will resurrect the file, unless a commit command intervened.

cf. remove examples for an example.

Unlike most other commands add never recurses down directories. It cannot yet handle relative paths. Instead of

$ cvs add foo/bar.c

you have to do

$ cd foo
$ cvs add bar.c

cvs add options
There are only two options you can give to add:

-k kflag
    This option specifies the default way that this file will be checked out. See rcs(1) and co(1). The kflag argument is stored in the RCS file and can be changed with admin. Specifying -ko is useful for checking in binaries that shouldn't have the RCS id strings expanded.

    Warning: this option is reported to be broken in version 1.3 and 1.3-s2 of CVS. Use admin -k after the commit instead. cf. admin.
-m description
    Using this option, you can give a description for the file. This description appears in the history log (if it is enabled, @pxref{history file}). It will also be saved in the RCS history file inside the repository when the file is committed. The log command displays this description. The description can be changed using admin -t. cf. admin. If you omit the -m description flag, an empty string will be used. You will not be prompted for a description.

cvs add examples
To add the file @file{backend.c} to the repository, with a description, the following can be used.

$ cvs add -m "Optimizer and code generation passes." backend.c
$ cvs commit -m "Early version. Not yet compilable." backend.c

cvs admin

    Function: Administration front end for rcs.
    Requires: repository, working directory.
    Changes: repository.
    Synonym: rcs

This is the CVS interface to assorted administrative RCS facilities, documented in rcs(1). admin simply passes all its options and arguments to the rcs command; it does no filtering or other processing. This command does work recursively, however, so extreme care should be used. Since this command is seldom used, it is not documented here. Complete documentation will appear here in the future.
cvs admin options
See rcs(1).
cvs admin examples
For the time being, the only example included here is an example of how not to use the admin command. It is included to stress the fact that this command can be quite dangerous unless you know exactly what you are doing. The -o option can be used to outdate old revisions from the history file. If you are short on disc this option might help you. But think twice before using it --- there is no way short of restoring the latest backup to undo this command! The next line is an example of a command that you would not like to execute.

$ cvs admin -o:R_1_02 .

The above command will delete all revisions up to, and including, the revision that corresponds to the tag R_1_02. But beware! If there are files that have not changed between R_1_02 and R_1_03 the file will have the same numerical revision number assigned to the tags R_1_02 and R_1_03. So not only will it be impossible to retrieve R_1_02; R_1_03 will also have to be restored from the tapes! Example 2: I use ``cvs admin'' all the time for comment leaders on files that are currently not recognized (which then defaults to ``# ''). If you cvs add then cvs commit a new file, and you want to change the comment leader (to one for nroff source, for example) I would use:

        cvs admin -c'.\" ' *.man

Then, I have to remove the local version of the file (which still has the ``# '' comment leader in it, even though ``cvs log'' says it is '.\" ', and update it.

        rm *.man
        cvs update *.man        # to get version with correct leaders.

cvs checkout

    Function: Checkout sources for editing
    Synopsis: checkout [options] modules...
    Requires: repository.
    Changes: working directory.
    Synonyms: co, get

Make a working directory containing copies of the source files specified by modules. You must execute checkout before using most of the other CVS commands, since most of them operate on your working directory. The modules part of the command are either symbolic names for some collection of source directories and files, or paths to directories or files in the repository. The symbolic names are defined in the modules file. @xref{modules}. Depending on the modules you specify, checkout may recursively create directories and populate them with the appropriate source files. You can then edit these source files at any time (regardless of whether other software developers are editing their own copies of the sources); update them to include new changes applied by others to the source repository; or commit your work as a permanent change to the source repository. Note that checkout is used to create directories. The top-level directory created is always added to the directory where checkout is invoked, and usually has the same name as the specified module. In the case of a module alias, the created sub-directory may have a different name, but you can be sure that it will be a sub-directory, and that checkout will show the relative path leading to each file as it is extracted into your private work area (unless you specify the -Q option). Running checkout on a directory that was already built by a prior checkout is also permitted, and has the same effect as specifying the -d option to the update command. cf. update.
cvs checkout options
These standard options are supported by checkout (cf. Common options, for a complete description of them):

-D date
    Use the most recent revision no later than date. This option is sticky, and implies -P.
-f
    Only useful with the -D date or -r tag flags. If no matching revision is found, retrieve the most recent revision (instead of ignoring the file).
-k kflag
    Process RCS keywords according to kflag. See co(1). This option is sticky; future updates of this file in this working directory will use the same kflag. The status command can be viewed to see the sticky options. cf. status.
-l
    Local; run only in current working directory.
-n
    Do not run any checkout program (as specified with the -o option in the modules file; @pxref{modules}).
-P
    Prune empty directories.
-p
    Pipe files to the standard output.
-Q
    Really quiet.
-q
    Somewhat quiet.
-r tag
    Use revision tag. This option is sticky, and implies -P.

In addition to those, you can use these special command options with checkout:

-A
    Reset any sticky tags, dates, or -k options. (If you get a working file using one of the -r, -D, or -k options, CVS remembers the corresponding tag, date, or kflag and continues using it for future updates; use the -A option to make CVS forget these specifications, and retrieve the `head' revision of the file).
-c
    Copy the module file, sorted, to the standard output, instead of creating or modifying any files or directories in your working directory.
-d dir
    Create a directory called dir for the working files, instead of using the module name. Unless you also use -N, the paths created under dir will be as short as possible.
-j tag
    Merge the changes made between the resulting revision and the revision that it is based on (e.g., if tag refers to a branch, CVS will merge all changes made on that branch into your working file). With two -j tag options, CVS will merge in the changes between the two respective revisions. This can be used to undo changes made between two revisions (@pxref{Merging two revisions}) in your working copy, or to move changes between different branches. In addition, each -j option can contain on optional date specification which, when used with branches, can limit the chosen revision to one within a specific date. An optional date is specified by adding a colon (:) to the tag. An example might be what import tells you to do when you have just imported sources that have conflicts with local changes:

    $ cvs checkout -jTAG:yesterday -jTAG module

-N
    Only useful together with -d dir. With this option, CVS will not shorten module paths in your working directory. (Normally, CVS shortens paths as much as possible when you specify an explicit target directory).
-s
    Like -c, but include the status of all modules, and sort it by the status string. @xref{modules}, for info about the -s option that is used inside the modules file to set the module status.

cvs checkout examples
Get a copy of the module tc:

$ cvs checkout tc

Get a copy of the module tc as it looked one day ago:

$ cvs checkout -D yesterday tc

cvs commit

    Function: Checks files into the repository
    Version 1.3 Synopsis: commit [-lnR] [-m 'log_message' | -f file] [-r revision] [files...]
    Version 1.3.1 Synopsis: commit [-lnRf] [-m 'log_message' | -F file] [-r revision] [files...]
    Requires: working directory, repository.
    Changes: repository.
    Synonym: ci

Warning: The -f file option will probably be renamed to -F file, and -f will be given a new meaning in future releases of CVS. Use commit when you want to incorporate changes from your working source files into the source repository.

If you don't specify particular files to commit, all of the files in your working current directory are examined. commit is careful to change in the repository only those files that you have really changed. By default (or if you explicitly specify the -R option), files in subdirectories are also examined and committed if they have changed; you can use the -l option to limit commit to the current directory only.

commit verifies that the selected files are up to date with the current revisions in the source repository; it will notify you, and exit without committing, if any of the specified files must be made current first with update (cf. update). commit does not call the update command for you, but rather leaves that for you to do when the time is right.

When all is well, an editor is invoked to allow you to enter a log message that will be written to one or more logging programs (@pxref{modules}, and @pxref{loginfo}) and placed in the RCS history file inside the repository. This log message can be retrieved with the log command; cf. log. You can specify the log message on the command line with the -m message option, and thus avoid the editor invocation, or use the -[fF] file option to specify that the argument file contains the log message.

cvs commit options
These standard options are supported by commit (@pxref{Common options}, for a complete description of them):

-l
    Local; run only in current working directory.
-n
    Do not run any module program.
-R
    Commit directories recursively. This is on by default.
-r revision
    Commit to revision. revision must be either a branch, or a revision on the main trunk that is higher than any existing revision number. You cannot commit to a specific revision on a branch.

commit also supports these options:

-F file
    This option is present in CVS releases 1.3-s3 and later. Read the log message from file, instead of invoking an editor.
-f
    This option is present in CVS 1.3-s3 and later releases of CVS. Note that this is not the standard meaning of the -f option as defined in Common options.

    Force CVS to commit a new revision even if you haven't made any changes to the file. If the current revision of file is 1.7, then the following two commands are equivalent:

    $ cvs commit -f file
    $ cvs commit -r 1.8 file

-f file
    This option is present in CVS releases 1.3, 1.3-s1 and 1.3-s2. Note that this is not the standard meaning of the -f option as defined in Common options.

    Read the log message from file, instead of invoking an editor.
-m message
    Use message as the log message, instead of invoking an editor.

cvs commit examples
@appendixsubsubsec New major release number When you make a major release of your product, you might want the revision numbers to track your major release number. You should normally not care about the revision numbers, but this is a thing that many people want to do, and it can be done without doing any harm. To bring all your files up to the RCS revision 3.0 (including those that haven't changed), you might do:

$ cvs commit -r 3.0

Note that it is generally a bad idea to try to make the RCS revision number equal to the current release number of your product. You should think of the revision number as an internal number that the CVS package maintains, and that you generally never need to care much about. Using the tag and rtag commands you can give symbolic names to the releases instead. cf tag and rtag. Note that the number you specify with -r must be larger than any existing revision number. That is, if revision 3.0 exists, you cannot cvs commit -r 1.3. @appendixsubsubsec Committing to a branch You can commit to a branch revision (one that has an even number of dots) with the -r option. To create a branch revision, use the -b option of the rtag or tag commands (@pxref{tag} or @pxref{rtag}). Then, either checkout or update can be used to base your sources on the newly created branch. From that point on, all commit changes made within these working sources will be automatically added to a branch revision, thereby not disturbing main-line development in any way. For example, if you had to create a patch to the 1.2 version of the product, even though the 2.0 version is already under development, you might do:

$ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
$ cvs checkout -r FCS1_2_Patch product_module
$ cd product_module
[[ hack away ]]
$ cvs commit

This works automatically since the -r option is sticky.

@appendixsubsubsec Creating the branch after editing Say you have been working on some extremely experimental software, based on whatever revision you happened to checkout last week. If others in your group would like to work on this software with you, but without disturbing main-line development, you could commit your change to a new branch. Others can then checkout your experimental stuff and utilize the full benefit of CVS conflict resolution. The scenario might look like:

[[ hacked sources are present ]]
$ cvs tag -b EXPR1
$ cvs update -r EXPR1
$ cvs commit

The update command will make the -r EXPR1 option sticky on all files. Note that your changes to the file will never be removed by the update command. The commit will automatically commit to the correct branch, because the -r is sticky. You could also do like this:

[[ hacked sources are present ]]
$ cvs tag -b EXPR1
$ cvs commit -r EXPR1

but then, only those files that were changed by you will have the -r EXPR1 sticky flag. If you hack away, and commit without specifying the -r EXPR1 flag, some files may accidentally end up on the main trunk.

To work with you on the experimental change, others would simply do

$ cvs checkout -r EXPR1 whatever_module

cvs diff

    Function: Runs diffs between revisions
    Synopsis: diff [-l] [rcsdiff_options] [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...]
    Requires: working directory, repository.
    Changes: nothing.

The diff command is used to compare different revisions of files. The default action is to compare your working files with the revisions they were based on, and report any differences that are found. If any file names are given, only those files are compared. If any directories are given, all files under them will be compared. The exit status will be 0 if no differences were found, 1 if some differences were found, and 2 if any error occurred.
cvs diff options
These standard options are supported by diff (@pxref{Common options}, for a complete description of them):

-D date
    Use the most recent revision no later than date. See -r for how this affects the comparison. CVS can be configured to pass the -D option through to rcsdiff (which in turn passes it on to diff. @sc{gnu} diff uses -D as a way to put cpp-style #define statements around the output differences. There is no way short of testing to figure out how CVS was configured. In the default configuration CVS will use the -D date option.
-k kflag
    Process RCS keywords according to kflag. See co(1).
-l
    Local; run only in current working directory.
-Q
    Really quiet.
-q
    Somewhat quiet.
-R
    Examine directories recursively. This option is on by default.
-r tag
    Compare with revision tag. Zero, one or two -r options can be present. With no -r option, the working file will be compared with the revision it was based on. With one -r, that revision will be compared to your current working file. With two -r options those two revisions will be compared (and your working file will not affect the outcome in any way). One or both -r options can be replaced by a -D date option, described above.

Any other options that are found are passed through to rcsdiff, which in turn passes them to diff. The exact meaning of the options depends on which diff you are using. The long options introduced in @sc{gnu} diff 2.0 are not yet supported in CVS. See the documentation for your diff to see which options are supported.
cvs diff examples
The following line produces a Unidiff (-u flag) between revision 1.14 and 1.19 of @file{backend.c}. Due to the -kk flag no keywords are expanded, so differences that only depends on keyword expansion are ignored.

$ cvs diff -kk -u -r 1.14 -r 1.19 backend.c

Suppose the experimental branch EXPR1 was based on a set of files tagged RELEASE_1_0. To see what has happened on that branch, the following can be used:

$ cvs diff -r RELEASE_1_0 -r EXPR1

A command like this can be used to produce a context diff between two releases:

$ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs

If you are maintaining ChangeLogs, a command like the following just before you commit your changes may help you write the ChangeLog entry. All local modifications that have not yet been committed will be printed.

$ cvs diff -u | less

cvs export

    Function: Export sources from CVS, similar to checkout
    Synopsis: export [-flNnQq] -r rev|-D date [-d dir] module...
    Requires: repository.
    Changes: current directory.

This command is a variant of checkout; use it when you want a copy of the source for module without the CVS administrative directories. For example, you might use export to prepare source for shipment off-site. This command requires that you specify a date or tag (with -D or -r), so that you can count on reproducing the source you ship to others. The keyword expansion option -kv is always set when export is used. This causes any RCS keywords to be expanded such that an import done at some other site will not lose the keyword revision information. There is no way to override this. Note that this breaks the ident command (which is part of the RCS suite---see ident(1)) which looks for RCS keyword strings. If you want to be able to use ident you must use checkout instead.
cvs export options
These standard options are supported by export (@pxref{Common options}, for a complete description of them):

-D date
    Use the most recent revision no later than date.
-f
    If no matching revision is found, retrieve the most recent revision (instead of ignoring the file).
-l
    Local; run only in current working directory.
-n
    Do not run any checkout program.
-Q
    Really quiet.
-q
    Somewhat quiet.
-R
    Export directories recursively. This is on by default.
-r tag
    Use revision tag.

In addition, these options (that are common to checkout and export) are also supported:

-d dir
    Create a directory called dir for the working files, instead of using the module name. Unless you also use -N, the paths created under dir will be as short as possible.
-N
    Only useful together with -d dir. With this option, CVS will not shorten module paths in your working directory. (Normally, CVS shortens paths as much as possible when you specify an explicit target directory.)

cvs export examples
Contributed examples are gratefully accepted.

cvs history

    Function: Shows status of files and users
    Synopsis: history [-report] [-flags] [-options args] [files...]
    Requires: the file @file{$CVSROOT/CVSROOT/history}
    Changes: nothing.

CVS can keep a history file that tracks each use of the checkout, commit, rtag, update, and release commands. You can use history to display this information in various formats. Logging must be enabled by creating the file @file{$CVSROOT/CVSROOT/history}. Warning: history uses -f, -l, -n, and -p in ways that conflict with the normal use inside CVS (@pxref{Common options}).
cvs history options
Several options (shown above as -report) control what kind of report is generated:

-c
    Report on each time commit was used (i.e., each time the repository was modified).
-e
    Everything (all record types); equivalent to specifying -xMACFROGWUT.
-m module
    Report on a particular module. (You can meaningfully use -m more than once on the command line.)
-o
    Report on checked-out modules.
-T
    Report on all tags.
-x type
    Extract a particular set of record types type from the CVS history. The types are indicated by single letters, which you may specify in combination. Certain commands have a single record type:

    F
        release
    O
        checkout
    T
        rtag

    One of four record types may result from an update:

    C
        A merge was necessary but collisions were detected (requiring manual merging).
    G
        A merge was necessary and it succeeded.
    U
        A working file was copied from the repository.
    W
        The working copy of a file is deleted during update (because it was gone from the repository).

    One of three record types results from commit:

    A
        A file was added for the first time.
    M
        A file was modified.
    R
        A file was removed.

The options shown as -flags constrain or expand the report without requiring option arguments:

-a
    Show data for all users (the default is to show data only for the user executing history).
-l
    Show last modification only.
-w
    Show only the records for modifications done from the same working directory where history is executing.

The options shown as -options args constrain the report based on an argument:

-b str
    Show data back to a record containing the string str in either the module name, the file name, or the repository path.
-D date
    Show data since date.
-p repository
    Show data for a particular source repository (you can specify several -p options on the same command line).
-r rev
    Show records referring to revisions since the revision or tag named rev appears in individual RCS files. Each RCS file is searched for the revision or tag.
-t tag
    Show records since tag tag was last added to the the history file. This differs from the -r flag above in that it reads only the history file, not the RCS files, and is much faster.
-u name
    Show records for user name.

cvs history examples
Contributed examples will gratefully be accepted.

cvs import

    Function: Import sources into CVS, using vendor branches
    Synopsis: import [-options] repository vendortag releasetag...
    Requires: Repository, source distribution directory.
    Changes: repository.

Use import to incorporate an entire source distribution from an outside source (e.g., a source vendor) into your source repository directory. You can use this command both for initial creation of a repository, and for wholesale updates to the module from the outside source. @xref{Tracking sources}, for a discussion on this subject.

The repository argument gives a directory name (or a path to a directory) under the CVS root directory for repositories; if the directory did not exist, import creates it.

When you use import for updates to source that has been modified in your source repository (since a prior import), it will notify you of any files that conflict in the two branches of development; use checkout -j to reconcile the differences, as import instructs you to do.

By default, certain file names are ignored during import: names associated with CVS administration, or with other common source control systems; common names for patch files, object files, archive files, and editor backup files; and other names that are usually artifacts of assorted utilities. Currently, the default list of ignored files includes files matching these names:

        RCSLOG  RCS     SCCS
        CVS*    cvslog.*
        tags    TAGS
        .make.state     .nse_depinfo
        *~      #*      .#*     ,*
        *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
        *.a     *.o     *.so    *.Z     *.elc   *.ln  
        core

If the file @file{$CVSROOT/CVSROOT/cvsignore} exists, any files whose names match the specifications in that file will also be ignored.

The outside source is saved in a first-level RCS branch, by default 1.1.1. Updates are leaves of this branch; for example, files from the first imported collection of source will be revision 1.1.1.1, then files from the first imported update will be revision 1.1.1.2, and so on.

At least three arguments are required. repository is needed to identify the collection of source. vendortag is a tag for the entire branch (e.g., for 1.1.1). You must also specify at least one releasetag to identify the files at the leaves created each time you execute import.

cvs import options
These standard options are supported by import (@pxref{Common options}, for a complete description of them):

-m message
    Use message as log information, instead of invoking an editor.
-Q
    Really quiet.
-q
    Somewhat quiet.

There are two additional special options.

-b branch
    Specify a first-level branch other than 1.1.1. Unless the -b branch flag is given, revisions will always be made to the branch 1.1.1---even if a vendortag that matches another branch is given! What happens in that case, is that the tag will be reset to 1.1.1. Warning: This behaviour might change in the future.

-I name
    Specify file names that should be ignored during import. You can use this option repeatedly. To avoid ignoring any files at all (even those ignored by default), specify `-I !'.

    name can be a file name pattern of the same type that you can specify in the @file{.cvsignore} file. @xref{cvsignore}.

cvs import examples
@xref{Tracking sources}.

cvs log

    Function: Prints out 'rlog' information for files
    Synopsis: log [-l] rlog-options [files...]
    Requires: repository, working directory.
    Changes: nothing.
    Synonym: rlog

Display log information for files. log calls the RCS utility rlog, which prints all available information about the RCS history file. This includes the location of the RCS file, the head revision (the latest revision on the trunk), all symbolic names (tags) and some other things. For each revision, the revision number, the author, the number of lines added/deleted and the log message are printed. All times are displayed in Coordinated Universal Time (UTC). (Other parts of CVS print times in the local timezone).

cvs log options
Only one option is interpreted by CVS and not passed on to rlog:

-l
    Local; run only in current working directory. (Default is to run recursively).

By default, rlog prints all information that is available. All other options (including those that normally have other meanings) are passed through to rlog and restrict the output. See rlog(1) for a complete description of options. This incomplete list (which is a slightly edited extract from rlog(1)) lists all options that are useful in conjunction with CVS.

Please note: There can be no space between the option and its argument, since rlog parses its options in a different way than CVS.

-b
    Print information about the revisions on the default branch, normally the highest branch on the trunk.
-ddates
    Print information about revisions with a checkin date/time in the ranges given by the semicolon-separated list of dates. The following table explains the available range formats:

    d1<d2
    x d2>d1
        Select the revisions that were deposited between d1 and d2 inclusive.
    <d
    x d>
        Select all revisions dated d or earlier.
    d<
    x >d
        Select all revisions dated d or later.
    d
        Select the single, latest revision dated d or earlier.

    The date/time strings d, d1, and d2 are in the free format explained in co(1). Quoting is normally necessary, especially for < and >. Note that the separator is a semicolon (;).
-h
    Print only the RCS pathname, working pathname, head, default branch, access list, locks, symbolic names, and suffix.
-R
    Print only the name of the RCS history file.
-rrevisions
    Print information about revisions given in the comma-separated list revisions of revisions and ranges. The following table explains the available range formats:

    rev1:rev2
        Revisions rev1 to rev2 (which must be on the same branch).
    :rev
        Revisions from the beginning of the branch up to and including rev
    rev:
        Revisions starting with rev to the end of the branch containing rev.
    branch
        An argument that is a branch means all revisions on that branch. You can unfortunately not specify a symbolic branch here. You must specify the numeric branch number. @xref{Branches and log}.
    branch1:branch2
        A range of branches means all revisions on the branches in that range.
    branch.
        The latest revision in branch.

    A bare -r with no revisions means the latest revision on the default branch, normally the trunk.
-sstates
    Print information about revisions whose state attributes match one of the states given in the comma-separated list states.
-t
    Print the same as -h, plus the descriptive text.
-wlogins
    Print information about revisions checked in by users with login names appearing in the comma-separated list logins. If logins is omitted, the user's login is assumed.

rlog prints the intersection of the revisions selected with the options -d, -l, -s, and -w, intersected with the union of the revisions selected by -b and -r.

cvs rdif

    Function: 'patch' format diffs between releases.
    Synopsis: rdiff [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules...
    Requires: repository.
    Changes: nothing.
    Synonym: patch

Builds a Larry Wall format patch(1) file between two releases, that can be fed directly into the patch program to bring an old release up-to-date with the new release. (This is one of the few CVS commands that operates directly from the repository, and doesn't require a prior checkout.) The diff output is sent to the standard output device.

You can specify (using the standard -r and -D options) any combination of one or two revisions or dates. If only one revision or date is specified, the patch file reflects differences between that revision or date and the current head revisions in the RCS file.

Note that if the software release affected is contained in more than one directory, then it may be necessary to specify the -p option to the patch command when patching the old sources, so that patch is able to find the files that are located in other directories.

cvs rdiff options
These standard options are supported by rdiff (@pxref{Common options}, for a complete description of them):

-D date
    Use the most recent revision no later than date.
-f
    If no matching revision is found, retrieve the most recent revision (instead of ignoring the file).
-l
    Local; don't descend subdirectories.
-Q
    Really quiet.
-q
    Somewhat quiet.
-r tag
    Use revision tag.

In addition to the above, these options are available:

-c
    Use the context diff format. This is the default format.
-s
    Create a summary change report instead of a patch. The summary includes information about files that were changed or added between the releases. It is sent to the standard output device. This is useful for finding out, for example, which files have changed between two dates or revisions.
-t
    A diff of the top two revisions is sent to the standard output device. This is most useful for seeing what the last change to a file was.
-u
    Use the unidiff format for the context diffs. This option is not available if your diff does not support the unidiff format. Remember that old versions of the patch program can't handle the unidiff format, so if you plan to post this patch to the net you should probably not use -u.
-V vn
    Expand RCS keywords according to the rules current in RCS version vn (the expansion format changed with RCS version 5).

cvs rdiff examples
Suppose you receive mail from @t{foo@@bar.com} asking for an update from release 1.2 to 1.4 of the tc compiler. You have no such patches on hand, but with CVS that can easily be fixed with a command such as this:

$ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \
$$ Mail -s 'The patches you asked for' foo@@bar.com

Suppose you have made release 1.3, and forked a branch called R_1_3fix for bugfixes. R_1_3_1 corresponds to release 1.3.1, which was made some time ago. Now, you want to see how much development has been done on the branch. This command can be used:

$ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name
cvs rdiff: Diffing module-name
File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6
File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4
File bar.h,v changed from revision 1.29.2.1 to 1.2

cvs release

    Function: Indicate that a Module is no longer in use
    Synopsis: release [-dQq] modules...
    Requires: Working directory.
    Changes: Working directory, history log.

This command is meant to safely cancel the effect of cvs checkout. Since CVS doesn't lock files, it isn't strictly necessary to use this command. You can always simply delete your working directory, if you like; but you risk losing changes you may have forgotten, and you leave no trace in the CVS history file (@pxref{history file}) that you've abandoned your checkout.

Use cvs release to avoid these problems. This command checks that no un-committed changes are present; that you are executing it from immediately above a CVS working directory; and that the repository recorded for your files is the same as the repository defined in the module database.

If all these conditions are true, cvs release leaves a record of its execution (attesting to your intentionally abandoning your checkout) in the CVS history log.

cvs release options
Only these standard options are supported by release.

-Q
    Really quiet.
-q
    Somewhat quiet.

In addition to the above, it supports one additional flag.

-d
    Delete your working copy of the file if the release succeeds. If this flag is not given your files will remain in your working directory.

    Warning: The release command uses rm -r @file{module} to delete your file. This has the very serious side-effect that any directory that you have created inside your checked-out sources, and not added to the repository (using the add command; @pxref{add}) will be silently deleted---even if it is non-empty!

cvs release output
Before release releases your sources it will print a one-line message for any file that is not up-to-date.

Warning: Any new directories that you have created, but not added to the CVS directory hierarchy with the add command (@pxref{add}) will be silently ignored, even if they contain files.

U file
    There exists a newer revision of this file in the repository, and you have not modified your local copy of the file.
A file
    The file has been added to your private copy of the sources, but has not yet been committed to the repository. If you delete your copy of the sources this file will be lost.
R file
    The file has been removed from your private copy of the sources, but has not yet been removed from the repository, since you have not yet committed the removal. cf. commit.
M file
    The file is modified in your working directory. There might also be a newer revision inside the repository.
? file
    file is in your working directory, but does not correspond to anything in the source repository, and is not in the list of files for CVS to ignore (see the description of the -I option, and @pxref{cvsignore}). If you remove your working sources, this file will be lost.

    Note that no warning message like this is printed for spurious directories that CVS encounters. The directory, and all its contents, are silently ignored.

cvs release examples
Release the module, and delete your local working copy of the files.

$ cd ..         # You must stand immediately above the
                # sources when you issue cvs release.
$ cvs release -d tc
You have [0] altered files in this repository.
Are you sure you want to release (and delete) module `tc: y
$

cvs remove

    Function: Removes an entry from the repository
    Synopsis: remove [-lR] [files...]
    Requires: Working directory.
    Changes: Working directory.
    Synonyms: rm, delete

Use this command to declare that you wish to remove files from the source repository. Like most CVS commands, cvs remove works on files in your working directory, not directly on the repository. As a safeguard, it also requires that you first erase the specified files from your working directory.

The files are not actually removed until you apply your changes to the repository with commit; at that point, the corresponding RCS files in the source repository are moved into the @file{Attic} directory (also within the source repository).

This command is recursive by default, scheduling all physically removed files that it finds for removal by the next commit. Use the -l option to avoid this recursion, or just specify the actual files that you wish removed.

cvs remove options
Two of the standard options are the only options supported by remove.

-l
    Local; run only in current working directory.
-R
    Commit directories recursively. This is on by default.

cvs remove examples
Remove a couple of files.

$ cd test
$ rm ?.c
$ cvs remove
cvs remove: Removing .
cvs remove: scheduling a.c for removal
cvs remove: scheduling b.c for removal
cvs remove: use 'CVS commit' to remove these files permanently
$ cvs ci -m "Removed unneeded files"
cvs commit: Examining .
cvs commit: Committing .

If you change your mind you can easily resurrect the file before you commit it, using the add command.

$ ls
CVS  ja.h  oj.c
$ rm oj.c
$ cvs remove oj.c
cvs remove: scheduling oj.c for removal
cvs remove: use 'CVS commit' to remove this file permanently
$ cvs add oj.c
U oj.c
cvs add: oj.c, version 1.1.1.1, resurrected

If you realise your mistake before you run the remove command you can use update to resurrect the file:

$ rm oj.c
$ cvs update oj.c
cvs update: warning: oj.c was lost
U oj.c

cvs rtag

    Function: Add a tag to the RCS file
    Synopsis: rtag [-falnRQq] [-b] [-d] [-r tag | -Ddate] symbolic_tag modules...
    Requires: repository.
    Changes: repository.
    Synonym: rfreeze

You can use this command to assign symbolic tags to particular, explicitly specified source revisions in the repository. rtag works directly on the repository contents (and requires no prior checkout). Use tag instead (@pxref{tag}), to base the selection of revisions on the contents of your working directory.

cvs rtag options
These standard options are supported by rtag (@pxref{Common options}, for a complete description of them):

-D date
    Tag the most recent revision no later than date.
-f
    Only useful with the -D date or -r tag flags. If no matching revision is found, use the most recent revision (instead of ignoring the file).
-l
    Local; run only in current working directory.
-n
    Do not run any tag program that was specified with the -t flag inside the @file{modules} file. (@pxref{modules}).
-Q
    Really quiet.
-q
    Somewhat quiet.
-R
    Commit directories recursively. This is on by default.
-r tag
    Only tag those files that contain tag. This can be used to rename a tag: tag only the files identified by the old tag, then delete the old tag, leaving the new tag on exactly the same files as the old tag.

In addition to the above common options, these options are available:

-a
    Use the -a option to have rtag look in the @file{Attic} (@pxref{Removing files}) for removed files that contain the specified tag. The tag is removed from these files, which makes it convenient to re-use a symbolic tag as development continues (and files get removed from the up-coming distribution).
-b
    Make the tag a branch tag. @xref{Branches}.
-d
    Delete the tag instead of creating it.

    In general, tags (often the symbolic names of software distributions) should not be removed, but the -d option is available as a means to remove completely obsolete symbolic names if necessary (as might be the case for an Alpha release, or if you mis-tagged a module).

cvs rtag examples

cvs status

    Function: Status info on the revisions
    Synopsis: status [-lR] [-v] [-Q] [files...]
    Requires: working directory, repository.
    Changes: nothing.

Display a brief report on the current status of files with respect to the source repository, including any sticky tags, dates, or -k options.

You can also use this command to anticipate the potential impact of a cvs update on your working source directory---but remember that things might change in the repository before you run update.

cvs status options
These standard options are supported by status (@pxref{Common options}, for a complete description of them):

-l
    Local; run only in current working directory.
-R
    Commit directories recursively. This is on by default.
-Q
    Really quiet. Do not print empty sticky parts.

There is one additional option:

-v
    Verbose. In addition to the information normally displayed, print all symbolic tags, together with the numerical value of the revision or branch they refer to.

cvs status examples

cvs tag

    Function: Add a symbolic tag to checked out version of RCS file
    Synopsis: tag [-lQqR] [-b] [-d] symbolic_tag [files...]
    Requires: working directory, repository.
    Changes: repository.
    Synonym: freeze

Use this command to assign symbolic tags to the nearest repository versions to your working sources. The tags are applied immediately to the repository, as with rtag, but the versions are supplied implicitly by the CVS records of your working files' history rather than applied explicitly.

One use for tags is to record a snapshot of the current sources when the software freeze date of a project arrives. As bugs are fixed after the freeze date, only those changed sources that are to be part of the release need be re-tagged.

The symbolic tags are meant to permanently record which revisions of which files were used in creating a software distribution. The checkout and update commands allow you to extract an exact copy of a tagged release at any time in the future, regardless of whether files have been changed, added, or removed since the release was tagged.

This command can also be used to delete a symbolic tag, or to create a branch. See the options section below.

cvs tag options
These standard options are supported by tag (@pxref{Common options}, for a complete description of them):

-l
    Local; run only in current working directory.
-R
    Commit directories recursively. This is on by default.
-Q
    Really quiet.
-q
    Somewhat quiet.

Two special options are available:

-b
    The -b option makes the tag a branch tag (@pxref{Branches}), allowing concurrent, isolated development. This is most useful for creating a patch to a previously released software distribution.
-d
    Delete a tag.

    If you use cvs tag -d symbolic_tag, the symbolic tag you specify is deleted instead of being added. Warning: Be very certain of your ground before you delete a tag; doing this effectively discards some historical information, which may later turn out to have been valuable.

cvs update

    Function: Brings work tree in sync with repository
    Synopsis: update [-AdflPpQqR] [-d] [-r tag|-D date] files...
    Requires: repository, working directory.
    Changes: working directory.

After you've run checkout to create your private copy of source from the common repository, other developers will continue changing the central source. From time to time, when it is convenient in your development process, you can use the update command from within your working directory to reconcile your work with any revisions applied to the source repository since your last checkout or update.

cvs update options
These standard options are available with update (@pxref{Common options}, for a complete description of them):

-D date
    Use the most recent revision no later than date. This option is sticky, and implies -P.
-f
    Only useful with the -D date or -r tag flags. If no matching revision is found, retrieve the most recent revision (instead of ignoring the file).
-k kflag
    Process RCS keywords according to kflag. See co(1). This option is sticky; future updates of this file in this working directory will use the same kflag. The status command can be viewed to see the sticky options. cf. status.
-l
    Local; run only in current working directory.
-P
    Prune empty directories.
-p
    Pipe files to the standard output.
-Q
    Really quiet.
-q
    Somewhat quiet.
-R
    Commit directories recursively. This is on by default.
-r tag
    Retrieve revision tag. This option is sticky, and implies -P.

These special options are also available with update.

-A
    Reset any sticky tags, dates, or -k options. (If you get a working copy of a file by using one of the -r, -D, or -k options, CVS remembers the corresponding tag, date, or kflag and continues using it on future updates; use the -A option to make CVS forget these specifications, and retrieve the head revision of the file).
-d
    Create any directories that exist in the repository if they're missing from the working directory. Normally, update acts only on directories and files that were already enrolled in your working directory.

    This is useful for updating directories that were created in the repository since the initial checkout; but it has an unfortunate side effect. If you deliberately avoided certain directories in the repository when you created your working directory (either through use of a module name or by listing explicitly the files and directories you wanted on the command line), then updating with -d will create those directories, which may not be what you want.
-I name
    Ignore files whose names match name (in your working directory) during the update. You can specify -I more than once on the command line to specify several files to ignore. By default, update ignores files whose names match any of the following:

            RCSLOG  RCS     SCCS
            CVS*    cvslog.*
            tags    TAGS
            .make.state     .nse_depinfo
            *~      #*      .#*     ,*
            *.old   *.bak   *.BAK   *.orig  *.rej   .del-*
            *.a     *.o     *.so    *.Z     *.elc   *.ln  
            core

    Use -I ! to avoid ignoring any files at all. @xref{cvsignore}, for other ways to make CVS ignore some files.

-jbranch
    Merge the changes made between the resulting revision and the revision that it is based on (e.g., if the tag refers to a branch, CVS will merge all changes made in that branch into your working file).

    With two -j options, CVS will merge in the changes between the two respective revisions. This can be used to remove a certain delta from your working file; if the file @file{foo.c} is based on revision 1.6 and you want to remove the changes made between 1.3 and 1.5, you might do:

    $ cvs update -j1.5 -j1.3 foo.c   # note the order...

    In addition, each -j option can contain on optional date specification which, when used with branches, can limit the chosen revision to one within a specific date. An optional date is specified by adding a colon (:) to the tag: -jSymbolic_Tag:Date_Specifier.

cvs update output
update keeps you informed of its progress by printing a line for each file, prefaced with one character that indicate the status of the file:

U file
    The file was brought up to date with respect to the repository. This is done for any file that exists in the repository but not in your source, and for files that you haven't changed but are not the most recent versions available in the repository.
A file
    The file has been added to your private copy of the sources, and will be added to the source repository when you run commit on the file. This is a reminder to you that the file needs to be committed.
R file
    The file has been removed from your private copy of the sources, and will be removed from the source repository when you run commit on the file. This is a reminder to you that the file needs to be committed.
M file
    The file is modified in your working directory.

    M can indicate one of two states for a file you're working on: either there were no modifications to the same file in the repository, so that your file remains as you last saw it; or there were modifications in the repository as well as in your copy, but they were merged successfully, without conflict, in your working directory.

    CVS will print some messages if it merges your work, and a backup copy of your working file (as it looked before you ran update) will be made. The exact name of that file is printed while update runs.

C file
    A conflict was detected while trying to merge your changes to file with changes from the source repository. file (the copy in your working directory) is now the output of the rcsmerge(1) command on the two revisions; an unmodified copy of your file is also in your working directory, with the name @file{.#file.revision} where revision is the RCS revision that your modified file started from. (Note that some systems automatically purge files that begin with @file{.#} if they have not been accessed for a few days. If you intend to keep a copy of your original file, it is a very good idea to rename it.)
? file
    file is in your working directory, but does not correspond to anything in the source repository, and is not in the list of files for CVS to ignore (see the description of the -I option, and @pxref{cvsignore}).

    Note that no warning message like this is printed for spurious directories that CVS encounters. The directory, and all its contents, are silently ignored.

cvs update examples
The following line will display all files are not up-to-date without actually change anything in yourworking directory. It can be used to check what has been going on with the project.

$ cvs -n -q update