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.
You can use svn merge to “undo” the change in your working copy, and then commit the local modification to the repository. All you need to do is to specify a reverse difference. (You can do this by specifying --revision 392:391 , or by an equivalent --change -392 .)
To roll back local changes in a file under SVN source control, right-click the file and select Source Control > Revert Local Changes and Release Locks. This command releases locks and reverts to the version in the last sandbox update (that is, the last version you synchronized or retrieved from the repository).
Right click on the selected revision(s), then select Context Menu → Revert changes from this revision. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.
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.
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 .
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With