Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN: Revert changes of a random revision, but preserve changes of all following ones

Situation: I've got a SVN repository with lets say 100 revisions, rev. 100 being the most recent one. I've done some changes in rev. 90 which need to be reverted now. The changes in rev. 90 are self-contained, so that they don't affect following revisions.

Problem: I'd like to revert only the changes in rev. 90, but still want to have all changes of all following revisions in my head revision.

Question: Is there any function in SVN to revert only the changes of a random revision?

like image 801
MicSim Avatar asked Aug 27 '10 08:08

MicSim


People also ask

How do I revert a specific revision in svn?

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.

How do you Uncommit changes in svn?

To undo a specific revision you can use the following command: $ svn merge -c -r3745 . In case you have other edited files in working directory, you can commit only the relevant files. Please note that undoing actually will mean you create a new revision with the negatives changes of last commit.

What does revert in svn do?

Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will not only revert the contents of an item in your working copy, but also any property changes.


1 Answers

You need to do a reverse-merge, that is a merge with the range rev:rev-1. For example on the command line, if you are in the working directory:

`svn merge -r 90:89 .`

In TortoiseSVN, it seems you need to enter 90 for Revision range to merge and check the Reverse merge checkbox in the Merge dialog (I don't have it so I can't confirm).

like image 122
DarkDust Avatar answered Nov 12 '22 03:11

DarkDust