SVN:如何返回到之前的版本?
我正在做的一个项目中犯了一系列错误。我如何恢复到已知的工作修订版并在此基础上进行构建?假设我现在处于修订版 15,但我想回到修订版 10,并继续处理版本 10 及以后的版本。我正在使用 Zend Studio。
我可以删除 SVN 中存在的修订吗?
A series of mistakes were made in a project I am working on. How do I revert back to a known working revision and build on top of that? Say I am at revision 15, but I want to go back to revision 10 -- and work on 10 onwards. I'm using Zend Studio.
Can I delete revisions that exist in SVN?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从命令行:
其中 [revision_number] 是您要恢复到的修订版本。
不,您不能删除 SVN 中已存在的修订。
From the command line:
Where [revision_number] is the revision you want to revert to.
And no, you cannot delete revisions that already exist in SVN.
您可以简单地使用以下命令对修订版进行更新,
但正如 Christoph 所建议的那样,这将不允许您提交更改,因为 SVN 需要您将工作副本更新为 HEAD,然后才能提交。你可以做的是
You can simply do an update to revision using
But as Christoph has suggested this will not let you commit the changes as SVN needs you to update your working copy to HEAD before you can commit. What you can do instead is
三个选项:
反向合并:(最快,保留错误修订版,添加新修订版)
SVN 转储:(完全删除错误修订版)
手动编辑:(删除错误的修订,不安全,最后的手段)
您可能需要此操作的唯一原因是,如果由于某种原因您具有文件级访问权限存储库,但没有 shell 访问权限。请注意,这仅在 SVN 1.6 和 1.7 上进行了测试。
$(GOODREV)
(如果保留在HEAD
中,完成后它将无法使用。)db/current
中的数字更改为$(GOODREV)
。请确保不要更改LF
行结尾。db/revs/*/*
和db/revprops/*/*
中所有 > 编号的文件(不是文件夹)$(GOODREV)
db/rep-cache.db
HEAD
,它现在应等于$ (GOODREV)
。请注意,如果您使用 TortoiseSVN,您还必须完成以下步骤:
%APPDATA%\ 中的所有文件TortoiseSVN\logcache\*
TSVNCache.exe
。 (通常有一个,但由于 UAC 安全性,在 WinVista+ 上可能为 2 个,这会阻止提升的应用程序与未提升的TSVNCache.exe
交互。第一次打开时来自提升的应用程序的另存为...
对话框,将生成提升的TSVNCache.exe
。)这将修复由于TortoiseSVN的缓存与新的回购状态。
Three options:
Reverse merge: (fastest, keeps bad revisions, adds new revision)
SVN dump: (removes bad revisions entirely)
Hand editing: (removes bad revisions, unsafe, last resort)
The only reason you might need this is if for some reason you have file-level access to the repository, but no shell access. Note that this has only been tested on SVN 1.6 and 1.7.
$(GOODREV)
(If left atHEAD
, it will be unusuable after we finish.)db/current
to the$(GOODREV)
. Be sure not to alter theLF
line ending.db/revs/*/*
anddb/revprops/*/*
that are >$(GOODREV)
db/rep-cache.db
HEAD
, which should now be equal to$(GOODREV)
.Note that if you are using TortoiseSVN, you must also complete these steps:
%APPDATA%\TortoiseSVN\logcache\*
TSVNCache.exe
via the Task Manager. (There's usually one, but could be 2 on WinVista+ due to UAC security, which prevents elevated applications from interacting with a non-elevatedTSVNCache.exe
. The first time you open aSave As...
dialog from an elevated application, an elevatedTSVNCache.exe
will spawn.)This will fix the weird log display caused by TortoiseSVN's cache being in conflict with the new repo state.
从 TortoiseSVN 办公站点获取文档。
我使用方法 2 并且在我这边工作得很好。
https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn- howto-rollback.html
Get the docs from TortoiseSVN office site.
I use method 2 and work fine on my side.
https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html