Git-2-SVN迁移? [英] Git-2-SVN migration?
问题描述
那么我碰巧遇到了一个需要将庞大的Git仓库迁移到Subversion的情况!下面是我在Edwin的评论中尝试的一个工作流程:首先创建一个本地SVN回购:
svnadmin create svn_repo
接下来我检查一下我的Git repo:
git clone git:myNameSpace / myProject
将
cd
放入 myProject
中并运行:
git svn init -s --prefix = svn / file:/// home / myHome / svn_repo / myProject
git svn fetch
git rev-list --parents master | grep'^ .\ {40 \} $'
查找根提交的散列并只给出一个提交。
接下来是获得空的中继提交的散列:
git rev-parse svn / trunk
$ b $
致命:ambiguous argument'svn / trunk':未知版本或路径不在工作树中。
使用' - '来分隔修订版本的路径
/ p>
我会建议您通过几个简单的步骤使用SubGit迁移它。
$ svnadmin create svn.repo
$ subgit configure svn.repo
$ nano svn.repo / conf / subgit.conf #edit path to your(bare !)Git仓库(如果你本地没有,你可以使用git clone --bare< URL> bare.git.repo)
$ subgit install
就是这样。虽然翻译SubGit会尽可能保留所有提交(即使是临时),分支,合并,忽略,日期,EOL设置,标签等。
翻译之后,版本库将会同步(每次推送到Git都将转换为SVN版本,反之亦然)。要打破同步(如果你不需要它)运行
$ subgit uninstall svn.repo
Yes, I know. Why would you want to migrate from Git to SVN?
Well I happen to be in a situation that I need to migrate a huge Git repo to Subversion! Here's one workflow I tried per Edwin's comment:
first create a local SVN repo:
svnadmin create svn_repo
Next I check out my Git repo:
git clone git:myNameSpace/myProject
cd
into the myProject
and run:
git svn init -s --prefix=svn/ file:///home/myHome/svn_repo/myProject
git svn fetch
git rev-list --parents master | grep '^.\{40\}$'
to look up the hash of your root commit and gives only one commit as it should.
Next is to get the hash of the empty trunk commit:
git rev-parse svn/trunk
This one unfortunately fails with:
fatal: ambiguous argument 'svn/trunk': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
Well I can't go much after this....
I would recommend you to migrate that with SubGit in several easy steps.
$ svnadmin create svn.repo
$ subgit configure svn.repo
$ nano svn.repo/conf/subgit.conf #edit path to your (bare!) Git repository (you may use "git clone --bare <URL> bare.git.repo" if you don't have it locally)
$ subgit install
That's all. While translation SubGit will try to preserve all commits (even temporary), branches, merges, ignores, dates, EOLs settings, tags and so on, as it it possible.
After translation the repositories will be in sync (each push to Git is translated to SVN revision and vice versa). To break synchronization (if you don't need it) run
$ subgit uninstall svn.repo
这篇关于Git-2-SVN迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!