是否有一个 Subversion 命令来重置工作副本? [英] Is there a Subversion command to reset the working copy?
问题描述
是否有一个 Subversion 命令可以将工作副本重置"到存储在存储库中的状态?类似于 git reset --hard
或(哈,Git 硬重置也不会删除未版本控制的文件!)rm -rf wc &&svn co <url>wc
.
Is there a single Subversion command that would "reset" a working copy exactly to the state that’s stored in the repository? Something like git reset --hard
or (ha, hard Git reset does not remove unversioned files either!) rm -rf wc && svn co <url> wc
.
更新:我不是在进行简单的恢复,因为这不会删除工作副本中的额外文件.我真的想要一些与删除工作副本并再次检出相同的东西,只是不必再次下载数据.(显然我不介意丢失所有未提交的更改.)
Update: I’m not after a simple revert, as that does not delete extra files in the working copy. I really want something that would be the same as deleting the working copy and checking it out again, only without having to download the data again. (Obviously I don’t mind losing all the uncommitted changes.)
推荐答案
你可以像这样递归地恢复:
You can recursively revert like this:
svn revert --recursive .
没有办法(不编写创意脚本)删除不受源代码控制的内容.我认为你能做的最接近的事情是遍历所有文件,然后使用 grep svn list
的结果,如果 grep 失败,则将其删除.
There is no way (without writing a creative script) to remove things that aren't under source control. I think the closest you could do is to iterate over all of the files, use then grep the result of svn list
, and if the grep fails, then delete it.
编辑:创意脚本的解决方案在这里:自动删除 Subversion 未版本化文件
EDIT: The solution for the creative script is here: Automatically remove Subversion unversioned files
因此,您可以创建一个脚本,将 revert
与链接问题中最适合您的答案结合起来.
So you could create a script that combines a revert
with whichever answer in the linked question suits you best.
这篇关于是否有一个 Subversion 命令来重置工作副本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!