git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to migrate a complex directory structure from SVN to GIT?

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jan 18, 2012, 10:43 UTC
Message-ID
<4F16A264.9030503@alum.mit.edu>
In-Reply-To
<1326828837924-7197567.post@n2.nabble.com>
On 01/17/2012 08:33 PM, Asuka wrote:
Show 29 quoted lines
> I would like to migrate my svn repository to git. The structure looks like
> the following:
> 
> svn
>    |_Project1
>          |_subproject1
>                |_branches
>                       |_branch1
>                       |_branch2
>                |_trunk
>                |_tags
>                       |_tagv1
>    |_Non-JavaProject
>          |_subproject
>    |_Project2
>           |_AnotherSubproject
>                |_SubSubproject
>           |_Subproject2
>                |_branches
>                |_tags
>           |_Subproject3
>                |_trunk
>           |_Subproject4
>                |_Subsubproject
>                        |_branches
>                        |_tags
>                        |_trunk
> 
> I would like to migrate all branches and tags

This can be confusing because Subversion confounds the namespace for lines of development (trunk, branches, and tags) with those of filename paths. The basic rule is: normally each trunk/branches/tag triplet corresponds to a single project, and each project should be converted into a separate git repository.

In your case it is hard to tell where the project boundaries are without more information.

If some projects don't have branches or tags, that is OK; you can configure git-svn pretty flexibly.

If some have branches and/or tags but not trunk, give it a try; I'm not sure whether git-svn can handle it.

If some subprojects (including their trunk/branches/tags directories) are nested within the source code of the enclosing projects (thus entangling the namespaces), then you have chaos even in the Subversion world. Such a mess can probably also be rescued, but it will be more involved. For example, you might use svndumpfilter to strip improperly-nested projects out of (copies of) your Subversion repository *before* converting the enclosing project, or play some kind of git-filter-branch tricks *after* the conversion.

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: AsukaNext: Jehan Bing
Message 2 of 4 in “How to migrate a complex directory structure from SVN to GIT?”
  1. AsukaJan 17, 2012
  2. Michael HaggertyJan 18, 2012
  3. Jehan BingJan 18, 2012
  4. David BarrJan 27, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.