简体   繁体   中英

Roll back SVN to previous revision without updating working copy

Is it possible to rollback SVN to a previous revision without doing an update first?

Revision 606 was fine. Then, at work, I did something that effectively deleted most of the project and committing that to 610. Now, I'm at home with a working 606. The usual way to roll back looks like this:

svn update
svn merge -r 610:606
svn commit -m "rolled back to r606"

That would entail deleting all of my files and then redownloading the entire project. Isn't there a better way? I want something like this:

svn copy 606 611  # not real syntax; this is what I'd *like* to be able to do

Clarification: The repository is rather large, so I'm trying to do this entirely on the server side (ie, without transferring the whole thing over the network).

Reverting commits is possible by way of merging, but has disadvantages.

Instead, if this is possible, dump the repository at revision 606 and create a fresh one from the dump. That way you can really remove those revisions completely. Obviously this is only possible if there were no other commits done that have to be preserved.

The solution was to delete the whole thing and then copy the old revision into the head. Deleting and copying can be done server-side by supplying full URLs everywhere. Note that with svn copy , you must copy into the parent (ie, svn copy …/a/b …/a/ ).

svn delete https://…/repos/proj/subproj
svn copy https://…/repos/proj/subproj@606 https://…/repos/proj/ -m "…"

(If anyone suggests an alternate way to do this without redownloading the entire project, I'll be happy to mark that as the answer.)

You can revert your branch back to 606 revision using following steps:

  1. svn merge --dry-run -r:610:606 "branch-url"
  2. svn merge -r:610:606 "branch-url"
  3. svn commit "reverted to 606" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM