如何在CVS中恢复已删除的文件?

Har*_*rry 39 cvs

我已经从CVS分支中删除了一个已签入的文件,即:

cvs remove -f file.txt
cvs commit
Run Code Online (Sandbox Code Playgroud)

如何恢复文件?

Jas*_*dge 39

我相信:

cvs add file.txt
cvs commit file.txt
Run Code Online (Sandbox Code Playgroud)

......将从阁楼中复活出来.


Har*_*rry 24

我发现你不能cvs add用来撤消cvs remove已经进行过操作的操作.这样可行:

$ cvs remove -f file.txt
$ cvs add file.txt
Run Code Online (Sandbox Code Playgroud)

但这不起作用:

$ cvs remove -f file.txt
$ cvs commit
$ cvs add file.txt
Run Code Online (Sandbox Code Playgroud)

到目前为止,我发现的最简单的方法是运行cvs status file.txt以找出修订号.然后获取修订版的内容并将其添加回:

$ cvs update -p -r rev file.txt > file.txt
$ cvs add file.txt
$ cvs commit
Run Code Online (Sandbox Code Playgroud)