Undo an undesired merge in SVN
Asked Answered
J

2

5

We have a repository running SVN. At some moment, to add a feature (lets call it 'branch'), we created a development branch from the main trunk (let's call it 'trunk').

We kept doing our work and commiting to the branch, occasionally, we merged changes made in the trunk into the branch to keep it the branch up to date with the trunk.

At some point, revisions 75051 to 77691 from the trunk were merged into the branch, and commits kept going on the branch, commiting new code in the branch.

But now we want the branch to be up to date with the trunk only up to revision 77089, that is, we want to undo the changes in the branch due to the merge we did, but only changes due to rev77089-77691, without affecting all work done in the branch. Any suggestions to revert or undo the changes in the branch due to rev77089-77691 in the trunk? Thank you very much.

Jaworski answered 3/7, 2013 at 16:29 Comment(0)
M
7

You can undo a change by simply use a reverse range in your svn merge command:

$ svn revert -R .   #Remove all changes made
$ svn update        #and make sure up to date
$ svn merge -r77691:77088 .

This will get rid of changes from 77089 to 77691 from your working directory.

Or you can undo the merge one revision at a time:

$ svn merge -c -77691 .
$ svn merge -c -77690 .
$ svn merge -c -77689 .
Maize answered 3/7, 2013 at 17:25 Comment(0)
K
5

In addition to the answer of David W. (+1 for that): If you use TortoiseSVN you can open the log (context menu: show log) of your branch, mark all revisions you do not net any more and make a revert (context menu: revert changes from this revision).

Kippar answered 4/7, 2013 at 5:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.