Go to the previous, next section.

add--Add a new file/directory to the repository

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. See section import--Import sources into CVS, using vendor branches.

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 (see section checkout--Check out sources for editing) or `update -d' (see section update--Bring work tree in sync with repository)).

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. See section 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

Go to the previous, next section.