开发者

Subversion 'unadd'?

I have a n开发者_JS百科umber of files I wish to add to subversion. Instead of taking my time and adding each individual one, I decided to be a smart-arse and do a:

svn add *

.. which was a mistake. Is there a way I can 'unadd' everything? There's about 7 files I wanted to add... it's now highlighted an extra 500+ auto-generated files I didn't mean to add!

I haven't committed it yet so hopefully there's a way to undo this!!


Do you have any changes other than the files added? (svn status will tell you - modified files will show as M, added files as A - and svn diff will show you the details of any changes). If not, then you can just do:

svn revert *

But if you do have changes other than adds, that will remove them!

(Probably worth experimenting on a few files first :-)


You can use

svn rm --keep-local *

All files will be kept as is, without revert. And unadd for the commit step.


svn st |grep ^A |cut -c 9- |xargs svn revert

To first verify what files will be reverted without modifying anything exclude the last command:

svn st |grep ^A |cut -c 9-

Piping commands is powerful:

  • svn st will stat everything
  • grep ^A will give only lines that start with the letter A for added.
  • cut -c 9- will get the file name from those lines.
  • xargs svn revert will run svn revert for each file name.

If you're on Windows you'll have to download the UnxUtils package or similar, but that's well worth it as it brings in a lot of powerful shell commands.


As long as you only have added new things, just do

svn revert *

To be safe, make a local copy of your files first.


You can use
svn revert -depth=infinity .

This will allso undo all local changes to you files, so use it carefully.


You can use next command:

svn revert
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜