如何恢复 svn 存储库中意外删除的文件夹

发布于 2024-08-03 08:31:21 字数 239 浏览 5 评论 0原文

我知道如何使用以下说明恢复到文件夹的特定版本:

http://aralbalkan.com/1381

但是,我删除了整个文件夹,并希望恢复该文件夹而不恢复存储库的其余部分。

我尝试重新创建该文件夹,然后将更改合并回来,但 svn 知道我的技巧并意识到它是一个新文件夹。

我该怎么做?

I know how to revert to a specific revision of a folder using these instructions:

http://aralbalkan.com/1381

However, I deleted the entire folder and want to get that folder back without reverting the rest of the repository.

I tried recreating the folder and then merging the changes back, but svn knows my trick and realizes it is a new folder.

How should I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一个人练习一个人 2024-08-10 08:31:21

最简单的方法可能是svn复制你想要的树,从它最后存在的版本:

svn copy src@rev dest

请参阅Subversion 书籍 了解详细信息。

The easiest way is probably to svn copy the tree you want, from the revision where it last existed:

svn copy src@rev dest

See the Subversion Book for details.

烏雲後面有陽光 2024-08-10 08:31:21

您可以签出新的工作副本,然后导出您感兴趣的文件夹。导出文件夹后,其中将不再包含 Subversion 元数据。然后,您可以将该文件夹放入从中删除的工作副本中。

祝你好运。

You could check out a new working copy, and then do an export of the folder you're interested in. Once you've exported the folder, it won't have subversion metadata in it. Then you can put the folder into the working copy that it was deleted from.

Best of luck.

拥抱影子 2024-08-10 08:31:21

如果您在重新创建文件夹后提交了更改,则可能会遇到与我相同的问题:

我丢失了文件的历史记录。然后我再次svn删除该文件夹,并且在执行操作时

svn cp ^/path/to/directory@revisionNumber /path/to/directory 

收到此错误:

svn: path "htttp://.../path/to/directory" not found for revision "revisionNumber".

在这种情况下,您可以使用辅助文件夹(~/tmp/)执行操作

cd ~/tmp; svn co -r revisionNumber /path/to/directory 

它将创建~/tmp/目录/文件夹及其包含的所有文件。
假设您删除目录的位置是 /location/of/my/trunk/path/to/ ,

然后

 cd location/of/my/trunk/path/; svn copy ~/tmp/directory/ to/

从该路径发出一个到它应该在树中的路径的命令。

If you have committed the changes after recreating the folder it is possible that you have the same problem I had:

I lost my history for the files. Then I svn deleted the folder again, and when doing a

svn cp ^/path/to/directory@revisionNumber /path/to/directory 

I received this error:

svn: path "htttp://.../path/to/directory" not found for revision "revisionNumber".

In that case you can use an auxiliary folder (~/tmp/) to do an

cd ~/tmp; svn co -r revisionNumber /path/to/directory 

It will create the ~/tmp/directory/ folder with all the files it contained.
suppose that the place where you deleted directory was /location/of/my/trunk/path/to/

and then issue an

 cd location/of/my/trunk/path/; svn copy ~/tmp/directory/ to/

from that path to the path it should be in your tree.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文