2016-09-19 45 views
0

我正在從SVN遷移到Git。我們有以下的結構在任何SVN倉庫:分支內的Java項目被視爲svn中git中的分隔分支或標籤?

-trunk 
    -javaproject1 
    -javaproject2 
-branch 
    -branch1 
     -javaproject1 
     -javaproject2 
    -branch2 
     -javaproject1 
     -javaproject2 
-tags 
    -tag1 
     -javaproject1 
     -javaproject2 
    -tag2 
     -javaproject1 
     -javaproject2 

作爲遷移的一部分,我將不得不只tag1branch1所以我用以下,以命令遷移。

git svn init <svn-repo-url> 

這將創建下列內容

[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 遷移完成,但它有許多分支創建.git我去改配置:

origin/branch1_javaproject_1 
origin/branch1_javaproject_2 
origin/tag1_javaproject_1 
origin/tag1_javaproject_2 
origin/master 

理想的情況下應該是

origin/branch1 
    origin/tag1 
    origin/master 

Master已正確創建,其中包含兩個Java項目,而標記nad分支是爲其中的每個java項目創建的。

回答

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/* 
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/*