[英]Converting Git repository into SVN with SubGit
我正在使用SubGit同步Git和SVN repos。 克隆远程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
如何同时合并bugfix和bugfix2分支的更改? 谢谢!
如果您的目标是从远程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
我登录后说vadishev的答案是有效的,并且是将完整历史记录导入到svn的最简单的解决方案。
我还想补充一点,如果你只需要映射主分支(故意省略git repo中的其他分支),你应该首先使用单分支标记克隆git repo,如下所示:
git clone git_url --branch git_branch --single-branch target_folder
谢谢你vadishev。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.