Does svn have a `revert-all` command?

2019-03-07 17:00发布

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

4条回答
走好不送
2楼-- · 2019-03-07 17:05

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
查看更多
成全新的幸福
3楼-- · 2019-03-07 17:08

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

查看更多
beautiful°
4楼-- · 2019-03-07 17:08

To revert modified files:

sudo svn revert
svn status|grep "^ *M" | sed -e 's/^ *M *//'
查看更多
该账号已被封号
5楼-- · 2019-03-07 17:24

Use the recursive switch --recursive (-R)

svn revert -R .
查看更多
登录 后发表回答