名称

svn delete — 从工作拷贝或版本库删除一个项目。

概要

svn delete PATH...
svn delete URL...

描述

Items specified by PATH are scheduled for deletion upon the next commit. Files (and directories that have not been committed) are immediately removed from the working copy unless the --keep-local option is given. The command will not remove any unversioned or modified items; use the --force option to override this behavior.

URL指定的项目会在直接提交中从版本库删除,多个URL的提交是原子操作。

别名

del, remove, rm

改变

Working copy if operating on files; repository if operating on URLs

是否访问版本库

对URL操作时访问

选项

--force
--force-log
--message (-m) TEXT
--file (-F) FILE
--quiet (-q)
--targets FILENAME
--with-revprop ARG
--keep-local
--username USER
--password PASS
--no-auth-cache
--non-interactive
--editor-cmd EDITOR
--encoding ENC
--config-dir DIR

例子

Using svn to delete a file from your working copy deletes your local copy of the file, but it merely schedules the file to be deleted from the repository. When you commit, the file is deleted in the repository.

$ svn delete myfile
D         myfile

$ svn commit -m "Deleted file 'myfile'."
Deleting       myfile
Transmitting file data .
Committed revision 14.

然而直接删除一个URL,你需要提供一个日志信息:

$ svn delete -m "Deleting file 'yourfile'" file:///var/svn/repos/test/yourfile

Committed revision 15.

如下是强制删除本地已修改文件的例子:

$ svn delete over-there 
svn: Attempting restricted operation for modified resource
svn: Use --force to override this restriction
svn: 'over-there' has local modifications

$ svn delete --force over-there 
D         over-there