名称

svn revert — 取消所有的本地编辑。

概要

svn revert PATH...

描述

Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will not only revert the contents of an item in your working copy, but also any property changes. Finally, you can use it to undo any scheduling operations that you may have done (e.g., files scheduled for addition or deletion can be “unscheduled”).

别名

改变

工作拷贝2

是否访问版本库

选项

--targets FILENAME
--depth ARG
--quiet (-q)
--config-dir DIR
--changelist ARG

例子

丢弃对一个文件的修改:

$ svn revert foo.c
Reverted foo.c

If you want to revert a whole directory of files, use the --depth=infinity option:

$ svn revert --depth=infinity .
Reverted newdir/afile
Reverted foo.c
Reverted bar.txt

最后,你可以取消预定的操作:

$ svn add mistake.txt whoops
A         mistake.txt
A         whoops
A         whoops/oopsie.c

$ svn revert mistake.txt whoops
Reverted mistake.txt
Reverted whoops

$ svn status
?      mistake.txt
?      whoops

警告

svn revert本身有固有的危险,因为它的目的是放弃数据—未提交的修改。一旦你选择了恢复,Subversion没有方法找回未提交的修改。

如果你没有给svn revert提供了目标,它不会做任何事情—为了保护你不小心失去对工作拷贝的修改,svn revert需要你提供至少一个目标。