开发者

svn: reverting to previous version

开发者 https://www.devze.com 2023-01-18 07:00 出处:网络
I mistakenly committed the wrong change to file, for a simplified example\'s sake let\'s call it foo.txt:

I mistakenly committed the wrong change to file, for a simplified example's sake let's call it foo.txt:

foo.txt, rev 300 (correct):

 E = mc^2

foo.txt, rev 301 (incorrect):

 E = mc^3

How do I re-commit rev 300 to the next commit? If I update foo.txt to rev 300, I get the right file but its status is correct & doesn't require being committed.

NOTE: It's only foo.txt that I want to revert. The other revisions in开发者_StackOverflow社区 rev 301 are important and I need to keep them.


svn merge -r301:300 foo.txt
svn commit -m 'revert foo.txt to 300'


If you're using TortoiseSVN, this is surprisingly easy. Just view the log for that file, right click on revision 300 and select revert to this revision (this is a local operation). Then you can commit your local file as 302.

Optionally, if this occurred quite some time ago, you can select revert changes from this revision. That will revert only the changes that occurred with that check in (you'd perform this on 301).


svn merge -c-301 .
svn commit -m "Reverting commit 301"
0

精彩评论

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