我们有一个从svn repo。
创建的git repo然而,在创建了一个git repo之后,一些东西被提交到了svn。
我可以为每个svn版本创建一个补丁并将其导入git,但这很耗时。
将最后n次提交从svn移动到git的最简单方法是什么?
答案 0 :(得分:2)
是否使用git svn
转换了Git存储库?
如果是,您只需要git svn fetch
然后合并。
如果不是,滚动的一种方法是使用git svn
重新转换整个Subversion存储库,然后从生成的存储库中获取必要的分支到现有的Git存储库和git cherry-pick
必要的范围承诺到相应的分支机构。
答案 1 :(得分:1)
$ git svn init <project url> --trunk=<path to trunk> local_repo
$ cd local_repo
$ git svn fetch --revision=X:HEAD # where X - last revision, that was already imported to git
$ cd ../your_actual_repo
$ git remote add tmp ../local_repo
$ git fetch --all
$ # cherry pick or rebase commits, that you want
# from remotes/tmp/master to master, you probably
# want to fix them afterwards with git rebase --interactive
$ git remote remove tmp