SVN在服务器端恢复
一位非常聪明的开发人员删除了几乎整个存储库并提交了它(修订版 210)。我的计算机上有一个工作副本,但存储库相当大。
我想创建一个与上一个良好修订版 (209) 相同的新修订版 (211)。我不想保留修订版 210 中的任何内容,这是错误的提交。这是开发人员的错,就我而言,他们将不得不重写任何内容。
有想法吗?
A very smart developer deleted almost an entire repository and committed it (rev 210). I have a working copy on my computer, but the repository is rather large.
I would like to create a new revision (211) that is identical to the last good revision (209). I don't want to keep anything from revision 210, which is the bad commit. It's the developers fault, and they will have to rewrite anything as far as I am concerned.
Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这可以通过反向合并来解决
:以下命令会将您的工作副本返回到修订版 209 的状态:
然后提交:
This can be solved by reverse-merging:
The following command will return your working copy to the state of revision 209:
Then commit:
如果该开发人员没有删除服务器上的存储库,那么您的所有代码都是安全的。要验证这一点,您所需要做的就是创建一个新的空文件夹,然后从修订版 209 而不是 HEAD 执行 SVN 签出。这将为您提供修订版 209 的每个文件的状态。您可以在任何开发工作站上执行此操作,无需在服务器上执行任何操作。
要恢复更改,只需在工作副本根目录中拉出 SVN 显示日志(如果使用 TSVN)窗口并选择修订版 209,然后选择恢复到修订版 - 这将反向合并修订版 210 中的更改,您可以然后签入修订版 211。这应该可以解决您的问题。
如果开发人员删除了您的 SVN 服务器上的存储库,您需要每日备份来恢复您的代码。
只要服务器上的存储库完好无损,就不可能从 SVN 中删除任何内容。当您删除某些内容时,它从那时起就变得不可见,但您始终可以返回到存储库中任何文件的任何版本 - 您只需要转到正确的修订版本即可。
If that developer didn't delete the repository on the server then all your code is safe. All you need to do to verify this is to create a new empty folder and then perform an SVN checkout from revision 209 instead of the HEAD. That will give you every single file in their state for revision 209. You can do this on any of your dev workstations, no need to do anything on the server.
To revert the changes, just pull up the SVN Show Log (if using TSVN) window in your working copy root and select revision 209, then select Revert to revision - this will do a reverse-merge of the changes in revision 210 which you can then check in as revision 211. That should solve your problem.
If the developer deleted the repository on your SVN server, you need a daily backup to restore your code.
As long as your repository on the server is intact it is not possible to delete anything from SVN. When you delete something, it simply becomes invisible from that point forward but you can always go back to any version of any file in the repository - you just need to go to the right revision.
有一种丑陋的方法对我有用......前提是您想删除最后一次提交而不是中间的一些提交。
首先 - 关闭 svn 服务器并通过 svnadmin hotcopy repo repo_backup 备份您的存储库
转到 SVN 服务器并继续您的存储库。查看 ./db/revs/X/,其中 X 是错误提交的第一个数字。您可以在那里看到错误的提交文件(例如 123)。删除此文件,然后修改 ./db/current 以指向之前的提交(例如122)。
There is one ugly way which works for me ... provided you want to delete the last commit and not some commit in the middle.
First - shutdown svn server and backup your repo by
svnadmin hotcopy repo repo_backup
Go to the SVN server and proceed your repo. Look into ./db/revs/X/ where X is the first number of the wrong commit. You can see the wrong commit file there (e.g 123). Remove this file and then modify ./db/current to point to the commit before (e.g.122).
稍微修改接受的答案,以防您使用 tortoise SVN
Modify the accepted answer a little in case you are using tortoise SVN
Linux 机器上的基本方法是:
希望你明白了
A rudimentary way on a Linux machine would be:
Hope you get the point