How to do ‘undo’ in TortoiseSVN

In one project, I found current revision had some errors and want to come back a old revision, so I use ‘update to revision’, but It looks like it don’t work as I think.

so how to roll back to a previous revision? en… now

Looking at TortoiseSVN’s menu or going through the list of command-line options you’ll see … gasp! … subversion forgot a roll-back feature! How could they do that?

http://jacwright.com/blog/75/how-to-roll-back-changes-using-subversion/

this article tell us how to do that, but he use merge to do that. I don’t think it’s a good way, the following I will show you what I did to roll back to old version.

There some different scenarios that need us to return back old revision.

1) You just want an earlier version of the code to use but not commit on.
2) You want to rewind the codebase to an earlier version and then be able to work with/commit using the earlier version as a starting point.
3) You want to rewind the codebase to an earlier version and then be able to work with and merge the changes with one revision after the earlier version.

Regarding the different requirements, we’ll choose different ways to handle. However, the actions that we used to use are revert to revision and update to revision 

If you want to do 2,3, then I think revert to revision is your best choice.

if you want to do 1, then update to revision is your choice.

Please see the following description, you will understand why I said that. Let’s go…..

First, we do some changes and commit it to repository.

imageimage

Check the revision, Now it’s 290.

Revert to revision

OK, we’d like to return back(Roll back) to the first revision, we look at it by selecting Tortoise SVN – > show log, And I found this revision and click Revert to this revision

image 

Now, we come back to previous revision, but please notice even the CONTENT of test.cxx comes back to previous revision, but the current SVN revision of this file is still current- 290. it’s very important. see

image

Now we change it again And commit changes. OK, it meets my requirement.

image image

Update to revision

image image

image

Here please pay attention to this revision flag, it was 287 not current 290.

image image

Now, I found the CONTENT of file return back to previous. It’s ok. then we do some changes and commit it again!

image

You will find this error when you want to commit it. [out-of-date]

image

Yes, it’s correct for SVN. Because you return back to revision 287 it’s an old revision. If you want to ‘undo’, obviously you choose an error function. Don’t use update to revision to do UNDO, but use revert to revision.

So if you insist to commit it, you have to do an update, before committing successfully.

That’s all  I have. Enjoy it!

原文地址:https://www.cnblogs.com/king_astar/p/1677049.html