Thursday, November 17, 2011

Roll back (Undo) revisions in the repository with TortoiseSVN

Learn how to revert (rollback / Undo) to a previous revision in the repository with TortoiseSVN ......

Use the revision log dialog

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 TortoiseSVNShow 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 the Shift key 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.

Use the merge dialog

To undo a larger range of revisions, you can use the Merge dialog. The previous method uses merging behind the scenes; this method uses it explicitly.
  1. In your working copy select TortoiseSVNMerge.
  2. In the From: field enter the full folder URL of the branch or tag containing the changes you want to revert in your working copy. This should come up as the default URL.
  3. In the From Revision field enter the revision number that you are currently at. If you are sure there is no-one else making changes, you can use the HEAD revision.
  4. make sure the Use "From:" URL checkbox is checked.
  5. In the To Revision field enter the revision number that you want to revert to, namely the one before the first revision to be reverted.
  6. Click OK to complete the merge.
You have reverted the changes within your working copy. Check the results, then commit the changes.

Use svndumpfilter

Since TortoiseSVN never loses data, your rolled back revisions still exist as intermediate revisions in the repository. Only the HEAD revision was changed to a previous state. If you want to make revisions disappear completely from your repository, erasing all trace that they ever existed, you have to use more extreme measures. Unless there is a really good reason to do this, it is not recommended. One possible reason would be that someone committed a confidential document to a public repository.
The only way to remove data from the repository is to use the Subversion command line tool svnadmin. You can find a description of how this works in the Repository Maintenance .
Post a Comment

Find a cool free stuff everyday

Giveaway of the Day

Hiren Bharadwa's Posts