AnkhSvn undo/revert a commit

别说谁变了你拦得住时间么 提交于 2019-12-01 04:53:13

问题


How do I undo/revert a change I've commited, with AnkhSvn/VS 2010. (I'm well aware you can't "delete" stuff in the subversion repository).

The issue is simple, You're working on HEAD(e.g. rev 100). You figure out something is broken. You view the history, and figure out rev 93 might be the issue. You want to revert the change done in rev 93, test, and commit those reverted changes.

While I know how to resort to the command line to "undo" this, How do you do this with AnkSvn from within Visual Studio ?


回答1:


Go to the history viewer (Right-click solution -> View Solution history), here right-click on a revision (or a selection of revisions), and use the items in the context menu to undo your changes.




回答2:


I use the following process:
With the solution working on the trunk HEAD and with no local files, right click the Solution, go Subversion -> merge

The Merge Wizard will pop up.

On the first page select 'Merge two different trees'

On the second page you want the 'From' to be the HEAD (Latest Version) and 'To' to be the specific revision to roll back to (93 in OP case) and using the 'From' URL.

On the third page, for text and binary conflicts I have 'prompt me for each' selected. I have depth as 'working copy' and leave 'Ignore ancestry' and 'allow unversioned obstructions' unchecked.

On the final Merge Summary page perform a dry-run first, check to see that the changes look correct. Then run the merge.

Finally, commit the changes to the trunk.




回答3:


AnkhSVN wasn't working when I did Update to a Specific Version, I kept getting an error message about "please update the out of date items and then retry commit". After some trial and error I figured out how to undo a committed file using the command Revert to this revision.

Say for example you are at revision 4440 and you want to make 4435 the new head. Use Revert to this revision to discard all changes after the selected revision.

How to make a prior committed version the new HEAD revision

NOTE: You may want to revert an entire a solution, but keep a couple changes made in the "un-done" revisions. If that's the case before you revert you could: copy out the newer files to a temporary location, do the revert, then copied them back in to revert everything but keep a few changed at the desired state.

Below is how to undo/revert a committed change with both ANKH and Tortoise.

ANKH

With solution open in Visual Studio, Right click context menu (this can be a Solution, Project, or any specific file) > View History > Select revision > context menu > Revert to this Revision.

ToirtoiseSVN

In file explorer right click on the file or folder (this could even be the top folder if you want to do a mass undo): Show Log to display a list of revisions, select a revision, then select Context MenuRevert to this revision. Then at the top folder level do Commit, and all of the items will be reverted.



来源:https://stackoverflow.com/questions/4723745/ankhsvn-undo-revert-a-commit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!