我正在从SVN迁移到Git。我们在SVN中的任何存储库都有以下结构:
-trunk
-javaproject1
-javaproject2
-branch
-branch1
-javaproject1
-javaproject2
-branch2
-javaproject1
-javaproject2
-tags
-tag1
-javaproject1
-javaproject2
-tag2
-javaproject1
-javaproject2
作为迁移的一部分,我只需要迁移tag1
和branch1
,所以我按顺序使用了以下命令。
git svn init <svn-repo-url>
这会创建.git
我去更改使用以下内容创建的配置
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[svn-remote "svn"]
url = <repo-svn-url>
fetch = trunk:refs/remotes/origin/trunk
branches = branches/branch1/*:refs/remotes/origin/branch1/*
tags = tags/tag1/*:refs/remotes/origin/tags/tag1/*
跑git svn fetch
迁移工作已经完成,但它有很多分支机构:
origin/branch1_javaproject_1
origin/branch1_javaproject_2
origin/tag1_javaproject_1
origin/tag1_javaproject_2
origin/master
理想情况下应该是
origin/branch1
origin/tag1
origin/master
使用其中的两个java项目正确创建了Master,而在其中的每个Java项目中都创建了标签nad分支。
答案 0 :(得分:0)
branches = branches/branch1/*:refs/remotes/origin/branch1/*
tags = tags/tag1/*:refs/remotes/origin/tags/tag1/*
这两个看起来相当错误。如果branch1
是分支,而tag1
是标记,则它们应为
branches = branches/*:refs/remotes/origin/branches/*
tags = tags/*:refs/remotes/origin/tags/*
答案 1 :(得分:0)
我能够通过再次抽取配置来解决它,如下所示
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[svn-remote "svn"]
url = svn-repo-url
fetch = trunk:refs/remotes/origin/trunk
branches = branches/{branch1}:refs/remotes/origin/*
tags = tags/{tag1}:refs/remotes/origin/tags/*