svn命令使用(回滚)
本文介绍svn revert及其子命令的使用
?
子命令svn revert
???? 取消所有的本地编辑。
子命令svn revert PATH...描述
???? Reverts any local changes to a file or directory and resolves any conflicted states. Svn revert will revert not only 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 performed (e.g., files scheduled for addition or deletion can be “unscheduled”).
选项
--changelist ARG
--depth ARG
--quiet (-q)
--recursive (-R)
--targets FILENAME
例子:
(1)丢弃对一个文件的修改:
$ svn revert foo.c
Reverted foo.c
?
(2)如果你希望恢复一整个目录的文件,可以使用--depth=infinity选项:
$ svn revert --depth=infinity .
Reverted newdir/afile
Reverted foo.c
Reverted bar.txt
(3)可以取消预定的操作:
$ 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
?
(4)回滚到指定版本:
?哈哈,根本不用svn revert命令,用svn up -r 版本号就可以了!!!
$ rm -rf filename
$svn up -r version_num filename
?