[英]Can I make git-svn import a Subversion repository which itself contains git repositories
I have a project in SVN which has a plugins folder. 我在SVN中有一个带有plugins文件夹的项目。 Several of the plugins folders are git repositories -- I added them to my plugins folder using
git clone
. 几个plugins文件夹是git存储库-我使用
git clone
将它们添加到了我的plugins文件夹中。
This has been working well for me but now I'm looking to migrate my SVN repository to git using git-svn
: 这对我来说一直很好,但是现在我希望使用
git-svn
将SVN存储库迁移到git:
git svn init http://path/to/my/repo --no-metadata
git config svn.authorsfile ~/authors.txt
git svn fetch
This works fine for all my early revisions which didn't have the git repos in my plugins folder, but when it hits the first revision containing a git repository it fails with the following error: 这对于我所有在我的plugins文件夹中没有git repos的早期版本都可以正常工作,但是当它到达包含git存储库的第一个版本时,它将失败并显示以下错误:
trunk/plugins/my_plugin/.git/HEAD was not found in commit
ae9ad0ab7cebd144c823d90d43cdab2b30d13f9e (r2259)
Is there a way around this to allow me to fully import my repository, perhaps by excluding any .git folders which reside in the SVN repository? 有没有办法解决这个问题,让我完全导入我的存储库,也许是通过排除驻留在SVN存储库中的任何.git文件夹?
It turns out that I was using git-svn 1.5 on Ubuntu which didn't support the --ignore-paths
flag on git-svn fetch
. 事实证明,我在Ubuntu上使用git-svn 1.5,而在
git-svn fetch
上不支持--ignore-paths
标志。 After building git 1.6 from source I can now run: 从源代码构建git 1.6之后,我现在可以运行:
git svn fetch --ignore-paths='\.git'
The fetch now ignores all .git
folders and successfully imports all the SVN history to my new git repository. 现在,提取操作将忽略所有
.git
文件夹,并将所有SVN历史记录成功导入到我的新git存储库中。
You could dump the current svn repo, filter out the .git directories, and create another svn repo based on this filtered dump, and use this new one as a basis for the git repo. 您可以转储当前的svn库, 过滤掉.git目录,并基于此过滤的转储创建另一个svn库,并将此新库用作git库的基础。
Parallel use of git and svn would probably be interesting - you'd have to replace the existing repo with new gitless one, and the missing .git directories could cause some hassles. 并行使用git和svn可能很有趣 -您必须用新的gitless替换现有的repo,而缺少的.git目录可能会带来麻烦。
I have not tried this, so you're going to want to be careful, and have backups. 我没有尝试过,所以您要小心,并要备份。
Due to the way Git works, having more than 1 .git folder will cause you problems (well, you already know that hehe). 由于Git的工作方式,拥有多个.git文件夹会给您带来麻烦(嗯,您已经知道了)。
You have 2 options: - if you don't care about story, do it the easy way: remove the .git folders from svn and move to git the full project 您有2种选择:-如果您不关心故事,请采用简单的方法:从svn中删除.git文件夹,然后将git移至整个项目
I know my team leader had some issues with that, but it works. 我知道我的团队负责人对此有一些问题,但是确实有效。
EDIT: I forgot to mention another way: you might use Bazaar to pull the project, as it interacts with both. 编辑:我忘了提另一种方式:您可能会使用Bazaar来拉该项目,因为它与两者交互。 Not sure if that would be easier though
不确定是否会更容易
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.