需要在 Subversion 中恢复已删除的分支

发布于 2024-08-07 23:46:36 字数 101 浏览 4 评论 0原文

我有两个 Subversion 存储库的工作副本,一个是主干,另一个是我创建的分支。

我不小心删除了存储库浏览器中的分支。如何恢复分支?有没有办法撤消整个存储库的最新提交?

I have two working copies of a Subversion repository, one of the trunk, and one of a branch I created.

I accidentally deleted the branch in a repository browser. How do I restore the branch? Is there a way to undo the most recent commit for the whole repository?

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

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

发布评论

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

评论(7

衣神在巴黎 2024-08-14 23:46:36

如果您使用 TortoiseSVN,这里有一个解决方案:

  1. 在存储库浏览器中,导航到您删除的文件夹的父文件夹(例如“branches”)。
  2. 右键单击该文件夹并执行“显示日志”。
  3. 找到您删除了特定分支文件夹的修订版本。
  4. 选择该修订版之前的修订版。
  5. 右键单击并选择“浏览存储库”。您现在正在查看删除分支之前的时间点的存储库状态。
  6. 找到您删除的分支文件夹,选择,右键单击,然后选择“复制到...”
  7. 您现在可以将已删除的文件夹复制到新名称甚至相同的名称。

Here is a solution if you are using TortoiseSVN:

  1. In the repo browser, navigate to the parent folder of the folder you deleted (e.g. "branches").
  2. Right click on the folder and do a "Show Log."
  3. Find the revision where you deleted the specific branch folder.
  4. Select the revision immediately before that revision.
  5. Right click and choose "Browse Repository." You are now looking at the state of the repository at the point in time right before you deleted the branch.
  6. Find the branch folder that you deleted, select, right-click, and choose "Copy to..."
  7. You can now copy the deleted folder to either a new name or even the same name.
人生百味 2024-08-14 23:46:36

使用:

svn cp [path to deleted branch]@[revision before delete] [new path]

例如:

svn cp svn://myrepo.com/svn/branches/2.0.5@1993 \
       svn://myrepo.com/svn/branches/2.0.5_restored

其中1993是删除前的修订版...

这里是一些很好的文档...

必须有某种方法可以转义用户名中的@符号...

Use:

svn cp [path to deleted branch]@[revision before delete] [new path]

For example:

svn cp svn://myrepo.com/svn/branches/2.0.5@1993 \
       svn://myrepo.com/svn/branches/2.0.5_restored

Where 1993 is the revision before the delete...

Here is some good documentation...

There must be some way of escaping the @ symbol in the username...

赠我空喜 2024-08-14 23:46:36

假设您的最后修订版本是 108:

svn merge --revision 108:107
svn diff 
svn commit -m "Reverted revision 108"

您还可以将源 URL 添加到合并中:

svn merge --revision 108:107 http://svn/repo/

Stack Overflow 上的其他位置:
撤消 TortoiseSVN 中的提交

Assuming your last revision was 108:

svn merge --revision 108:107
svn diff 
svn commit -m "Reverted revision 108"

You can also add your source URL to the merge:

svn merge --revision 108:107 http://svn/repo/

Elsewhere on Stack Overflow:
Undoing a commit in TortoiseSVN

梦与时光遇 2024-08-14 23:46:36

我遇到了这个问题,但上面的命令对我不起作用。做什么就容易多了。在删除分支之前,我在一次修订中检查了该分支。

被删除的版本是 9331。我在 9330 上检查了它:

svn co https://svn.acme.com/svn/giantFlySwatterTargetingSystem/branches/bug1234@9330 restored

这是我想要的简单解决方案。

I ran into this problem, but the above command didn't work for me. What did was much easier. I checked out the branch at one revision before I removed it.

The revision that was removed was 9331. I checked it out at 9330:

svn co https://svn.acme.com/svn/giantFlySwatterTargetingSystem/branches/bug1234@9330 restored

That was the easy solution I wanted.

☆獨立☆ 2024-08-14 23:46:36

这对我有用,

svn cp --username your_user_name
https://path_to_your_repo/branches/deleted_branch_name@last_revision_before_deletion< /强>
https://path_to_your_repo/branches/new_name_for_branch


This worked for me,

svn cp --username your_user_name
https://path_to_your_repo/branches/deleted_branch_name@last_revision_before_deletion
https://path_to_your_repo/branches/new_name_for_branch

陪你到最终 2024-08-14 23:46:36

或者,如果是单个提交删除了分支:

恢复提交,然后提交

svn merge -c -REV .
svn commit -m "Reverting deletion of branch XYZ"

Alternatively, if it was a single commit that deleted the branch:

Revert the commit and then commit

svn merge -c -REV .
svn commit -m "Reverting deletion of branch XYZ"
音栖息无 2024-08-14 23:46:36

我遇到了同样的问题,并在 SmartSVN (Enterprise 6.0.2) 中以这种方式解决了它:

  • 在 trunk/HEAD 调用菜单存储库上打开视图
  • /在存储库浏览器中打开(分支文件夹中不存在已删除的分支)
  • 在存储库中浏览器,调用菜单 Repository / Show Revision...
  • 选择删除之前的修订(已删除的分支重新出现在分支文件夹中)
  • 右键单击已删除的分支,在菜单中选择复制并输入与目标相同的路径

I ran into the same problem and solved it this way in SmartSVN (Enterprise 6.0.2):

  • Open a view on the trunk/HEAD
  • Call menu Repository / Open in Repository Browser (the deleted branch is absent from the branches folder)
  • In the repository browser, call menu Repository / Show Revision...
  • Select the revision just before the deletion (the deleted branch reappears in the branches folder)
  • Right-click on the deleted branch, select Copy in the menu and enter the same path for the destination
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文