参考下面两个问答:
http://stackoverflow.com/questions/8139605/does-svn-have-a-revert-all-command
-----------------------------------
You could do:
svn revert -R .
This will not delete any new file not under version control. But you can easily write a shell script to do that like:
for file in `svn status|grep "^ *?"|sed -e 's/^ *? *//'`; do rm $file ; done
-----------------------------------
There is a command
svn revert -R .
In addition
If you want to revert a whole directory of files,you can use the --depth=infinity option:
svn revert --depth=infinity
svn revert
is inherently dangerous, since its entire purpose is to throw away data—namely, your uncommitted changes. Once you've reverted, Subversion provides no way to get back those uncommitted changes
-----------------------------------
http://stackoverflow.com/questions/1239998/how-can-i-remove-all-my-changes-in-my-svn-working-directory
-----------------------------------
Used a combination of other peoples answers to come up with this solution
revert normal local svn changes
svn revert -R .
remove any other change and supports removing files/folders with spaces, etc.
svn status --no-ignore | grep -E '(^\?)|(^\I)' | sed -e 's/^. *//' | sed -e 's/\(.*\)/"\1"/' | xargs rm -rf
don't forget to get the latest files from svn
svn update --force
-----------------------------------
None of the answers here were quite what I wanted. Here's what I came up with:
# Recursively revert any locally-changed files
svn revert -R .
# Delete any other files in the sandbox (including ignored files),
# being careful to handle files with spaces in the name
svn status --no-ignore | grep '^\?' | \
perl -ne 'print "$1\n" if $_ =~ /^\S+\s+(.*)$/' | \
tr '\n' '\0' | xargs -0 rm -rf
Tested on Linux; may work in Cygwin, but relies on (I believe) a GNU-specific extension which allows xargs to split based on '\0'
instead of whitespace.
The advantage to the above command is that it does not require any network activity to reset the sandbox. You get exactly what you had before, and you lose all your changes. (disclaimer before someone blames me for this code destroying their work) ;-)
I use this script on a continuous integration system where I want to make sure a clean build is performed after running some tests.
Edit: I'm not sure this works with all versions of Subversion. It's not clear if the svn status
command is always formatted consistently. Use at your own risk, as with any command that uses such a blanket rm
command.
-----------------------------------
svn status | grep '^M' | sed -e 's/^.//' | xargs rm
svn update
Will remove any file which has been modified. I seem to remember having trouble with revert when files and directories may have been added.
-----------------------------------
-----------------------------------
相关推荐
对网上的SVN备份、还原、清理几天之前的备份进行了测试与修改。 全量备份:fullbackup.bat(使用前先修改目录)、hotcopy.bat 增量备份:svndump.bat(使用前先修改目录)、dump.bat、projectlist.conf(使用前先修改svn...
在windows下,打开命令窗口,进入下列目录: "c:\Program Files\VisualSVN Server\bin\" 执行: svnadmin.exe 输入下列命令并执行: svnadmin dump D:\Repositories\TestProject > D:\svndumpfile\TestProject_...
码云SVN提交处理空目录,自动添加keep。可选择其他默认文件
SVN的标准目录结构:trunk、branches、tags
Jenkins自动化部署获取svn二级目录,Jenkins部署教程和动态获取svn路径教程
关于怎样在svn上找回以前的文件版本的图像操作方法
清楚svn目录下生成的.svn所有文件夹
windows下批量删除SVN文件夹,很好用的
svn 清除 目录svn 清除 目录svn 清除 目录svn 清除 目录
SVN目录结构说明 SVN目录结构说明 SVN目录结构说明 SVN目录结构说明
针对svn的用户、权限、目录的管理 建立版本库 设置密码文件 设置权限文件
本文介绍了svn的三种备份方法,其中svnsync是我在windows环境下试验成功过的,而很多其他资料都无法成功,希望能给大家正确的指引 绝对值得大家下载!!!
s1、备份1、找到svnserver的仓库地址(里面看不到具体的代码文件,不过没关系)2、打开svnserver,中bin目录,开启cmd窗口3、命令导出svn
这是一个删除一个目录下的svn文件和目录的脚本,只需要把要删除svn相关的目录放到同级目录下即可,然后双击脚本,一键清除
----------------------------------------- 一条指令清理使用SVN客户端引起的 .svn 目录... 当该文件夹整个打包发送给别人或备份时,这些.svn作为冗余且不安全的内容一起打包,这个很是不爽! 【解决办法】 见附件
删除指定目录的.svn文件(包含子目录),直接执行脚本就行。超级方便
常见项目svn目录结构
SVN 备份及还原包括逻辑和物理备份,逻辑备份包含了本地备份和通过FTP脚本的备份,定期执行计划保证数据丢失。里面有3个文档和编写好的bat脚本
svnserver备份脚本,其中包含了备份repository,压缩备份文件、复制备份文件到远程计算机和还原备份说明。svn服务器的时间格式要改成YYYY-MM-DD,不然Backup.bat脚本会报错。最好不要使用svnserver4以上的版本,因为...
平时我们说的冲突,是因为对同一文件...树冲突,指的是由于目录(文件)树的改变,造成内容修改修改不能匹配在同一对象(目录/文件)上。本文介绍了重现 update 导致树冲突的重现过程,对SVN冲突解决机制进行实例探讨。