有没有更好的方法来恢复 git-svn 分支?

发布于 2024-12-02 17:11:39 字数 263 浏览 0 评论 0原文

将我的 SVN 存储库克隆到 GIT 后,我在 GIT 存储库中删除了我不太可能使用的 SVN 分支,因为我没有读过如何加载特定分支。

现在我需要将它们全部恢复,但无法轻松恢复它们(一次恢复一个会有点慢)。 git svn fetch 对我不起作用,因为主干是最新的,并且分支很长一段时间没有更改(即使更改了 git svn 配置) 但是移动或删除 .git/svn 目录然后 git svn fetch 导致完全恢复。

但还有更好的办法吗?

After cloning my SVN repo into GIT, I deleted in my GIT repository the SVN branches that I was not likely to use as I had not read of how to just load a specific branch.

Now I need them all back but could not easily recover them (One at a time would be a bit slow).
git svn fetch did not work for me as the trunk was up to date and the branches haven't change in a long time (even with changing around the git svn config)
But moving or removing the .git/svn directory and then
git svn fetch caused a complete recovery.

But is there a better way ?

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

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

发布评论

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

评论(1

药祭#氼 2024-12-09 17:11:39

你的方法似乎是最简单的。

另一种方法是列出所有可能代表删除分支尖端的悬空提交(也就是说,如果您很久以前没有删除它们,因为默认情况下它们会在 30 天后从您的存储库中删除。
请参阅“列出并删除以下的 Git 提交没有分支(悬空?)”和“在 Git 中,你如何查看和管理不在分支中的提交?”来查看 git reflogs 和 git fsck 的实际操作。

git fsck --unreachable --no-reflogs

但这对于您的情况来说是实用的,因为您需要“猜测”悬空尖端对应于哪个远程分支。

You method seems the most straightforward.

The other way is to list all the dangling commits which could represent the tip of the delete branches (that is, if you haven't deleted them too long ago, since by default they would be pruned from your repo after 30 days.
See "Listing and deleting Git commits that are under no branch (dangling?)" and "In Git, how do you see and manage commits that aren't in a branch?" to see the git reflogs and git fsck in action for this.

git fsck --unreachable --no-reflogs

But that would be practical in your case, as you would need to "guess" to which remote branch that dangling tip corresponds to.

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