git svn克隆特定分支并合并 [英] git svn clone specific branches and merge

查看:69
本文介绍了git svn克隆特定分支并合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望将我的代码库从svn迁移到git.我的svn存储库中有太多分支.我只希望克隆几个分支并将它们合并在一起并将其推入git.我要避免克隆所有分支,因为这需要很长时间.我该如何实现?

I am looking to migrate my codebase from svn to git. There are too many branches in my svn repo. I only wish to clone couple of branches and merge them together and push it to git. I want to avoid cloning all branches as it takes long time. How do I achieve this?

完成后,我想定期从这些svn分支获取更新,合并它们并更新git repo,并且svn将在特定时间内处于活动状态.如果我不得不再次克隆它,那将是浪费时间.有什么方法可以满足我的要求?

After it's done, I want to periodically get update from those svn branches, merge them and update the git repo and the svn will be active for certain period of time. It would be waste of time if I have to clone it again. Is there a way to do what I require?

推荐答案

我认为SubGit工具可能是适合您情况的最佳解决方案:

I think SubGit tool might be the best solution for your case:

https://subgit.com

它允许将数据从SVN转换到Git,包括并排除其中的任何分支/标记甚至目录,因此很容易仅获得您想要在Git中拥有的那些分支.假设,如果您有分支"branch_1"…"branch_N",但打算在Git中仅包含"branch_3"和"branch_4"(以及"trunk"),则可以按以下方式设置SubGit:

It allows translating data from SVN to Git including and excluding any branches/tags or even directories inside, so it's easy to get only those branches you want to have in Git. Say, if you have branches 'branch_1'… 'branch_N', but intend to have in Git only 'branch_3' and 'branch_4' (along with 'trunk'), then you can set SubGit as follows:

[svn]

trunk=trunk:/refs/heads/master   
branches=branches/branch_3:/refs/heads/branch_3   
branches=branches/branch_4:/refs/heads/branch_4

,只有那些分支才会出现在Git中.

and only those branches will appear in Git.

SubGit支持SVN和Git之间的连续双向镜像,因此,不仅可以从SVN获取更新,而且还可以从Git发送更新.也可能只能通过定期运行import来从SVN获取更新,但是在这种情况下,不应在GIt中更改来自SVN的分支.

SubGit supports continuous two-way mirror between SVN and Git, so it's perfectly possible not only get updates from SVN, but send those from Git, too. It also possible to only get updates from SVN by running import periodically, yet in this case, branches that came from SVN should not be changed in GIt.

这篇关于git svn克隆特定分支并合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆