Once you issue a 'cvs delete' command, there is no way to undo its effect by running another cvs command. Every time you do a 'cvs update' it tells you that the file has a 'R' flag and you should 'commit' to finally delete it from CVS. If you've changed your mind and don't want to commit file deletion, there is still something you can do.
We begin with deleting a file, just in case. The following command will delete the file immediately from the current directory and will mark it for deletion from the repository.
$ ls CVS test_file.php $ cvs delete -f test_file.php cvs remove: scheduling `test_file.php' for removal cvs remove: use `cvs commit' to remove this file permanently $ ls CVS $ cvs -q up R test_file.php $ ls CVS
Soon you realise that the file is still useful and you don't want to delete it... The easiest way to revive the file is to modify CVS/Entries file (relative to the location of the deleted file).
$ less CVS/Entries .. /test_file.php/-1.1/Fri Feb 10 05:55:07 2006// ..
Notice the hyphen (-) before the version number: -1.1. This is CVS's way of marking the file for deletion upon next commit.
Entries file is where CVS keeps information about all checked out files. If a new file is added to the repository, CVS will check it out and add a record into the 'Entries' file.
This leads to the conclusion that if a line is removed from this file CVS will think that it hasn't been checked out yet, so CVS will do whatever it usually does to provide you the latest snapshot of the versioned file structure. So, in order to 'undelete' our file we can simply delete the line from 'Entries' file containing the its name.
$ less CVS/Entries .. .. $ cvs -q up U test_file.php $ less CVS/Entries .. /test_file.php/1.1/Fri Feb 10 05:55:07 2006// .. $ cvs -q up [nothing displayed] $ ls CVS test_file.php
The file is back and nothing happened to the repository.