我正在使用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分支中的更改?谢谢!
发布于 2012-06-18 22:24:25
如果您的目标是从远程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发布于 2014-07-18 10:58:16
我登录说vadishev的答案是有效的,并且是将具有完整历史的git存储库导入到svn的最简单的解决方案。
我还想补充的是,如果您只需要映射主分支(有意忽略git代码库中的其他分支),您应该首先克隆带有单个分支标志的git代码库,如下所示:
git克隆git_url --分支git_branch --单分支target_folder
谢谢你瓦迪舍夫。
https://stackoverflow.com/questions/11048396
复制相似问题