Does svn have a `revert-all` command?

本小妞迷上赌 提交于 2020-01-11 14:48:16

问题


If I want to throw away all of my changes, and return to the code that is on the repository, I do the following:

$ rm -fr *
$ svn up

This is easy enough, but I'm wondering if there is a single command that will accomplish this, something like:

$ svn revert-all

回答1:


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



回答2:


There is a command

svn revert -R .

OR
you can use the --depth=infinity, which is actually same as above:

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




回答3:


Use the recursive switch --recursive (-R)

svn revert -R .



回答4:


To revert modified files:

sudo svn revert
svn status|grep "^ *M" | sed -e 's/^ *M *//'


来源:https://stackoverflow.com/questions/8139605/does-svn-have-a-revert-all-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!