Previous section   Next section

2.9 Removing Files

To remove a file from the repository, first remove the file from the sandbox directory; then run the following command from the sandbox directory that contained the file:

cvs remove filename

The deletion does not take effect until the next cvs commit command is run; the file remains in the repository until then.

Example 2-20 shows a deletion. After the cvs commit is run, CVS doesn't remove the file entirely; it puts it in a special subdirectory in the repository called Attic. This saves the file history and enables the file to be returned to the repository later.

CVS opens an editor so you can record the reason for the file deletion, as it does when you commit changes.

Example 2-20. Removing a file
$ rm file3
$ cvs remove file3
cvs remove: scheduling `file3' for removal
cvs remove: use 'cvs commit' to remove this file permanently
$ cvs commit
...
Log message editor opens
...
Removing file3;" 9L, 308C written
/var/lib/cvsroot/example/file3,v  <--  file3
new revision: delete; previous revision: 1.1
done

CVS does not remove directories from the repository, because doing so would break the change tracking. Use the -P flag to cvs checkout and cvs update to avoid empty directories in your sandbox.


  Previous section   Next section
Top