版本库中回滚(撤销)版本

使用版本日志对话框

By far the easiest way to revert the changes from one or more revisions, is to use the revision log dialog.

  1. 选中想要恢复变更的文件或者文件夹。如果想要恢复所有的变更,需要选中最顶层的文件夹。

  2. 选择TortoiseSVN显示日志,显示出版本列表。有可能需要使用全部显示或者下100(条) 按钮,把想要恢复的版本显示出来。

  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. If you want to pick out individual revisions and ranges, use the Ctrl key while selecting revisions. Right click on the selected revision(s), then select Context MenuRevert changes from this revision.

  4. 如果想要把以前的某个版本变成最新版本,右键点击选中的版本,然后选择右键菜单恢复到此版本。就能够撤销被选中版本后面所有的变更。

工作副本已经恢复到了变更以前的状态。检查恢复后的结果,然后提交变更。

使用合并对话框

If you want to enter revision numbers as a list, you can use the Merge dialog. The previous method uses merging behind the scenes; this method uses it explicitly.

  1. 在工作副本上选择 TortoiseSVN合并

  2. In the Merge Type dialog select Merge a range of revisions.

  3. In the From: field enter the full repository URL of your working copy folder. This should come up as the default URL.

  4. In the Revision range to merge field enter the list of revisions to roll back (or use the log dialog to select them as described above).

  5. 确保撤销合并选项框处于被选中的状态。

  6. In the Merge options dialog accept the defaults.

  7. 点击合并完成合并。

You have reverted the changes within your working copy. Check that the results are as expected, then commit the changes.

使用 svndumpfilter

因为TortoiseSVN绝不会丢弃数据,所以那些被回滚的版本仍然以中间版本的形式被保留在版本库里。只是最新版本已经回到了以前的状态。如果想让版本库里的某些版本彻底消失,擦去这些版本曾经存在过的所有痕迹,就必须采取更极端的手段。不推荐使用这种方法,除非有很好的理由。比如某人向一个公开的版本库里提交了一份机密文件。

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.