|Version Management with CVS - the CVS manual|
by Per Cederqvist et al.
Paperback (6"x9"), 216 pages, 8 figures
RRP £19.95 ($29.95)
7.1 Adding files to a directory
To add a new file to a directory, follow these steps.
- You must have a working copy of the directory. See section 1.3.1 Getting the source.
- Create the new file inside your working copy of the directory.
- Use ‘cvs add filename’ to tell CVS that you want to version control the file. If the file contains binary data, specify ‘-kb’ (see section 9 Handling binary files).
- Use ‘cvs commit filename’ to actually check in the file into the repository. Other developers cannot see the file until you perform this step.
You can also use the
add command to add a new
Unlike most other commands, the
add command is
not recursive. You have to explicitly name files and
directories that you wish to add to the repository.
However, each directory will need to be added
separately before you will be able to add new files
to those directories.
$ mkdir -p foo/bar $ cp ~/myfile foo/bar/myfile $ cvs add foo foo/bar $ cvs add foo/bar/myfile
- Command: cvs add [
-mmessage] files ...
Schedule files to be added to the repository. The files or directories specified with
addmust already exist in the current directory. To add a whole new directory hierarchy to the source repository (for example, files received from a third-party vendor), use the
importcommand instead. See section A.13 import--Import sources into CVS, using vendor branches.
The added files are not placed in the source repository until you use
committo make the change permanent. Doing an
addon a file that was removed with the
removecommand will undo the effect of the
remove, unless a
The ‘-k’ option specifies the default way that this file will be checked out; for more information see section 12.4 Substitution modes.
The ‘-m’ option specifies a description for the file. This description appears in the history log (if it is enabled, see section B.9 The history file). It will also be saved in the version history inside the repository when the file is committed. The
logcommand displays this description. The description can be changed using ‘admin -t’. See section A.6 admin--Administration. If you omit the ‘-m description’ flag, an empty string will be used. You will not be prompted for a description.
For example, the following commands add the file ‘backend.c’ to the repository:
$ cvs add backend.c $ cvs commit -m "Early version." backend.c
When you add a file it is added only on the branch which you are working on (see section 5 Branching and merging). You can later merge the additions to another branch if you want (see section 5.9 Merging can add or remove files).
|ISBN 0954161718||Version Management with CVS - the CVS manual||See the print edition|