Search code examples
gitgithubsvngit-svn

Migration from SVN to GitHub


I am using git-svn for the migration from SVN to GitHub. Below is how files are structured on the SVN repo, let's called it projects_repo

Projects_Repo/

- BranchQA_Test/ 

 - project1/
 - project2/
 - project3/
 - project4/

- tags/ 

 - project1/
 - project2/

- trunk/ 

 - project1/
 - project2/
 - project3/
 - project4/
 - project5/

I want to migrate ONLY trunk(master) to GitHub, each project becomes one standalone repo on GitHub, with the histories and without tags.

So the GitHub will look like:

- project1/
- project2/
- project3/
- project4/
- project5/

How should I customize the git-svn command? Right now I am using the following:

git svn clone http://url/svn/projects_repo/ 
    --username $username 
    --authors-file=authors_modified.txt 
    --trunk=trunk/project1/   
    --no-metadata -s project1 `

Since the migration consumes lots of time, I want to confirm in advance. Does anyone have an idea whether this is the correct approach? Thanks a lot.


Solution

  • As already said in the comments: if you use any of --{trunk,branches,tags} — be sure to omit the -s/--stdlayout. Although the docs say --stdlayout has lower precedence — better be safe than sorry. Because git-svn imports do indeed take a lot of time.

    man 1 git-svn:

    -T<trunk_subdir> --trunk=<trunk_subdir>
    -t<tags_subdir> --tags=<tags_subdir>
    -b<branches_subdir> --branches=<branches_subdir>
    -s --stdlayout
    These are optional command-line options for init. Each of these flags can point
    to a relative repository path (--tags=project/tags)
    or a full url (--tags=https://foo.org/project/tags).
    You can specify more than one --tags and/or --branches options, in case your
    Subversion repository places tags or branches under multiple paths.
    The option --stdlayout is a shorthand way of setting trunk,tags,branches
    as the relative paths, which is the Subversion default.
    If any of the other options are given as well, they take precedence.