-->

转换Git仓库到SVN与SubGit(Converting Git repository into

2019-09-18 03:28发布

我使用SubGit同步Git和SVN的回购协议。 当克隆一个远程的Git回购我想保留回购的全部历史。 步骤我跟着目前允许我只复制主分支的历史:

svnadmin create svn_repos
subgit-1.0.0-EAP_1381/bin/subgit configure svn_repos
subgit-1.0.0-EAP_1381/bin/subgit install svn_repos
git clone svn_repos gitRepo

cd gitRepo/
git remote add -f newRemote git://127.0.0.1/gitRepo
...
From git://127.0.0.1/gitRepo
 * [new branch]      FirstProductionTag -> newRemote/FirstProductionTag
 * [new branch]      SecondProductionTag -> newRemote/SecondProductionTag
 * [new branch]      ThirdProductionTag -> newRemote/ThirdProductionTag
 * [new branch]      bugfix     -> newRemote/bugfix
 * [new branch]      bugfix2    -> newRemote/bugfix2
 * [new branch]      master     -> newRemote/master

git merge -s ours --no-commit newRemote/master
git read-tree --prefix=foo/bar/ -u newRemote/master 
git commit -m "Merged new Remote into subdirectory /foo/bar"
git push origin master

我该如何合并从漏洞修复和bugfix2分支在同一时间的变化? 谢谢!

Answer 1:

如果你的目标是获得远程Git仓库Subversion版本库,并保持同步两个库,可考虑执行以下操作:

$ svnadmin create svn_repos
$ git clone --mirror git://127.0.0.1/gitRepo svn_repos/.git
$ subgit-1.0.0-EAP_1381/bin/subgit install svn_repos


Answer 2:

我登录到说,vadishev的答案工程,并配有完整的历史进口git仓库到SVN最简单的解决方案。

我还想补充一点,你应该只需要主分支映射(有意省略的混帐回购协议的其他分支),你应该先用克隆像这样的单支旗的混帐回购协议:

混帐克隆git_url --branch git_branch --single分支TARGET_FOLDER

谢谢vadishev。



文章来源: Converting Git repository into SVN with SubGit
标签: git svn subgit