有没有更好的方法来恢复 git-svn 分支?
将我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的方法似乎是最简单的。
另一种方法是列出所有可能代表删除分支尖端的悬空提交(也就是说,如果您很久以前没有删除它们,因为默认情况下它们会在 30 天后从您的存储库中删除。
请参阅“列出并删除以下的 Git 提交没有分支(悬空?)”和“在 Git 中,你如何查看和管理不在分支中的提交?”来查看 git reflogs 和 git fsck 的实际操作。
但这对于您的情况来说是实用的,因为您需要“猜测”悬空尖端对应于哪个远程分支。
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
andgit fsck
in action for this.But that would be practical in your case, as you would need to "guess" to which remote branch that dangling tip corresponds to.