Fix svn after running 'svn up' from a subdirectory

47 Views Asked by At

I'm working on a Rails app with SVN. I just ran 'svn up' from within app/assets/javascripts. That resulted in the whole repo being downloaded and copied into app/assets/javascripts, so I then had app/assets/javascripts/app, /lib, /Gemfile.lock, etc. I went ahead and deleted all these files, but now 'svn st' lists them all as locally deleted. I'm used to using Git, so I didn't realise that 'svn up' was sensitive to the current working directory like that. How do I fix this?

If I 'svn rm' them all and then commit, will this mess up the remote repo?

1

There are 1 best solutions below

0
Michael Schlottke-Lakemper On

If you deleted files on your working copy that are tracked by svn, you can undelete them by calling

svn revert path/to/deleted/file

If you want to restore all files that were accidentally deleted in your svn directory, this one-liner will do the trick for you:

svn status | grep '^!' | awk '{print $2}' | xargs svn revert

Generally, the revert subcommand will always restore your local files to the state of their last commit.