Reverting to a previous revision using TortoiseSVN

SvnTortoisesvnRevisionRevert

Svn Problem Overview


What is the easiest way to revert my working copy to a previous revision using Windows TortoiseSVN?

I did not find any "findable" command to do that quickly.

Svn Solutions


Solution 1 - Svn

There are several ways to do that. But do not just update to the earlier revision as suggested here.

The easiest way to revert the changes from a single revision, or from a range of revisions, is to use the revision log dialog. This is also the method to use of you want to discard recent changes and make an earlier revision the new HEAD.

  1. Select the file or folder in which you need to revert the changes. If you want to revert all changes, this should be the top level folder.
  2. Select TortoiseSVN → Show Log to display a list of revisions. You may need to use Show All or Next 100 to show the revision(s) you are interested in.
  3. Select the revision you wish to revert. If you want to undo a range of revisions, select the first one and hold Shift while selecting the last one. Note that for multiple revisions, the range must be unbroken with no gaps. Right click on the selected revision(s), then select Context MenuRevert changes from this revision.
  4. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context MenuRevert to this revision. This will discard all changes after the selected revision.

You have reverted the changes within your working copy. Check the results, then commit the changes.

All solutions are explained in the "How Do I..." part of the TortoiseSVN docs.

Solution 2 - Svn

I have used the same instructions Stefan used, taken from Tortoise website.

But it's important to click COMMIT right after. I was getting crazy until I realized that.

If you need to make an older revision your head revision do the following:

  1. Select the file or folder in which you need to revert the changes. If you want to revert all changes, this should be the top level folder.

  2. Select TortoiseSVN → Show Log to display a list of revisions. You may need to use Show All or Next 100 to show the revision(s) you are interested in.

  3. Right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.

  4. Make a commit.

Solution 3 - Svn

Right click on the folder which is under SVN control, go to TortoiseSVNShow log. Write down the revision you want to revert to and then go to TortoiseSVNUpdate to revision....

Enter image description here

Solution 4 - Svn

The Revert command in the context menu ignores your edits and returns the working copy to its previous state. You may also select the desired revision other than the "Head" when you "CheckOut" from the repository.

Solution 5 - Svn

Here's another method that's unorthodox, but works*.

I recently found myself in a situation where I'd checked in breaking code, knowing that I couldn't update our production code to it until all the integration work had taken place (in retrospect this was a bad decision, but we didn't expect to get stalled out, but other projects took precedence). That was several months ago, and the integration has been stalled for that entire time. Along comes a requirement to change the base code and get it into production last week without the breaking change.

Here's what we did:

After verifying that the new requirement doesn't break anything when using the revision before my check in, I made a copy of the working directory containing the new code. Then I deleted everything in the working directory and checked out the revision I wanted to it. Then I deleted all the files I'd just checked out, and copied in the files from the working copy. Then I committed that change, effectively wiping out the breaking change from the repository and getting the production code in place as the head revision. We still have the breaking change available, but it's no longer in the head revision so we can move forward to production.

*I don't recommend this method, but if you find yourself in a similar situation, it's a way out that's not too painful.

Solution 6 - Svn

In the TortoiseSVN context menu, select 'Update to Revision', enter the desired revision number, and voilà :)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRicardo AlaminoView Question on Stackoverflow
Solution 1 - SvnStefanView Answer on Stackoverflow
Solution 2 - SvnilansView Answer on Stackoverflow
Solution 3 - SvnRafael ColucciView Answer on Stackoverflow
Solution 4 - SvnM.SameerView Answer on Stackoverflow
Solution 5 - SvndelliottgView Answer on Stackoverflow
Solution 6 - SvnEric EijkelenboomView Answer on Stackoverflow