What is Reverse Merge ( Revert Merge ) in SVN, a simple explanation and the step by step processes from start to finish would be great.
Can someone give me the the processes, numbered if you can. And a good and simple example would be great too.
What is Reverse Merge ( Revert Merge ) in SVN, a simple explanation and the step by step processes from start to finish would be great.
Can someone give me the the processes, numbered if you can. And a good and simple example would be great too.
From Tortoise User Guide:
If you want to merge changes back out of your working copy, to revert a change which has already been committed, select the revisions to revert and make sure the Reverse merge box is checked.
From my point of view a reverse merge is a "normal" commit which represents an "anti"-commit to one or more former commits. The former commit will still exist, but the changes become reverted through new "anti"-commit.
A reverse merge is formally the same as a merge, but, of course, in reverse order. Changes from reversely-merged revisions become undone in your working copy.
For example, if you want to go back from HEAD to rev. 123, you would reverse-merge like this, assuming your working copy is in HEAD state:
svn merge -r HEAD:123
This will set your working copy in the state of revision 123, but it will formally be based on HEAD. Your working copy state is then the same as if you had manually edited your files back to revision 123. Nothing will have changed in the repository as of yet.
Note that this is not the same as updating to revision 123. If you had done that, although your working copy files would have the same content in both cases, your working copy state would be different: SVN would know that your working copy was based on revision 123 instead of HEAD. If you then tried to commit the changes, it would tell you that you should update to HEAD first, which would undo the update to revision 123, assuming that you have not changed anything in the meantime.
Back to our original scenario. If you are satisfied with the reverse merge, then you can check it in to the repository:
svn commit -m "We undid all changes since r123."
Or, if you feel you have made a mistake, you can revert the reverse merge, which is something completely different, as it only sets your working copy back to the repository state is is based on (in our case, HEAD):
svn revert --recursive .
But be careful with that one, it irreversibly reverts your reverse merge :-). The dot refers to the current directory, and must be specified explicitly (as is not the case with most other SVN commands) as a safety measure to avoid accidentally reverting anything.
© 2022 - 2024 — McMap. All rights reserved.