How to do ‘undo’ in TortoiseSVN

本文详细介绍了如何使用Subversion (SVN) 进行版本回滚操作,包括使用还原到指定版本和更新到指定版本两种方式的区别,并通过实例说明了何时应该选择哪种方法。

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/archive/2010/03/03/1677049.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值