To add a file to a project in the repository, first create the file in your sandbox. Be sure to consider your project’s structure and place the file in the correct directory. Then, issue the following command from the sandbox directory containing the file:
cvs add filename
This command marks the new file for inclusion in the repository. Directories are added with the same command. Files within a directory can’t be added until the directory itself is added. A file is only marked for addition when you run cvs add; it is actually added to the repository when the next cvs commit is run. A directory is added to the repository immediately. Example 2-19 shows a file being created and added to the repository. Remember that the file is not actually stored in the repository until the cvs commit command is run. Figure 2-10 shows the same file addition in gCVS.
Example 2-19. Adding files
$ touch file3 $ cvs add file3 cvs add: scheduling file `file3' for addition cvs add: use 'cvs commit' to add this file permanently $ cvs commit ... Log message editor opens ... RCS file: /var/lib/cvsroot/example/file3,v done Checking in file3; /var/lib/cvsroot/example/file3,v <-- file3 initial revision: 1.1 done
Figure 2-10.Adding files with gCVS
If you have binary files or other files that are not plain text, please see the section “Binary Files and Wrappers” in Chapter 3 before adding them to the repository. These files should be added with the -kb command option.
As with committing for other reasons, an editor window will open asking you to enter a log message describing the files to be added.