AnkhSvn undo/revert a commit
How do I undo/revert a change I've commi开发者_Python百科ted, 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 ?
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.
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.
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 Menu
→ Revert to this revision
. Then at the top folder level do Commit
, and all of the items will be reverted.
精彩评论