Sounds like a stupid question, because when you know the answer to this problem it just seems blindingly obvious,
but what if you've issued a 'remove' against a file in CVS and before you commit the remove you decided that you
made a mistake and still want to keep it?
I.E you issued (for example)
> cvs remove -f sheep.php
But not issued
> cvs commit -m removed sheep.php
I've heard work arounds such as:
- Edit the "entries" file in the relevant CVS directory in your workspace, removing the reference to the file.
This makes the file appear unknown to CVS. - Perform an update in that directory. This gets the repository version of the file and updates the "entries"
file correctly
All you actually need to do is re-add the file:
> cvs add sheep.php
U sheep.php
cvs server: sheep.php, version 1.6, resurrected
When used in this way, the add command will issue an update against the file and retrieve the repository version of the file.
A word of warning though, if you had uncommitted changes in that file before you issued a remove, CVS isn't going to recover that for you...
How about if you've removed a file, but your version of the file is out of date and so you can't commit it?
So you've issued the following:
> cvs remove -f sheep.txt
cvs server: scheduling 'sheep.txt' for removal
cvs server: use 'cvs sheep' to remove this file permanently
> cvs commit -m removed sheep.txt
cvs server: Up-to-date check failed for 'sheep.txt'
cvs server: correct above errors first!
You can't issue an update because you get the following:
> cvs update sheep.txt
cvs server: conflict: removed sheep.txt was modified by second party
C rob_tmp.txt
Again, add the file.
> cvs add sheep.php
U sheep.php
cvs server: sheep.php, version 1.6, resurrected
This gets you the most up to date version from the repository, that you can then check for changes (you wouldn't want to just remove it now that someone's added new content would you?)
Once you've convinced yourself that it's still a good idea to delete it, just issue the remove and commit.
Simple when you know how!