svn 删除 (del, remove, rm)

示例

使用 svn 从工作副本中删除文件会删除您本地文件的副本,但它只是将该文件安排从存储库中删除。当您提交时,该文件将在存储库中被删除。

$ 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

使用 --keep-local 选项可覆盖 svn delete 的默认行为,即删除已安排进行版本控制删除的目标文件。当您意识到自己意外地提交了需要保留在工作副本中的文件的添加,但该文件不应添加到版本控制时,此方法非常有用。

$ svn delete --keep-local conf/program.conf

D conf/program.conf

$ svn commit -m "Remove accidentally-added configuration file."

Deleting conf/program.conf

Transmitting file data .

Committed revision 21.

$ svn status

? conf/program.conf

$