Home > Mobile >  git svn fetch is separating branch's subfolders into their own remote branches
git svn fetch is separating branch's subfolders into their own remote branches

Time:12-29

I'm trying to migrate my SVN repo into a git repo, with a non-standard layout. I have my trunk and branches in the same folder in the SVN repo. My SVN repository's structure is like so:

branches/
  releases/
    1.0/
      back_end/
      front_end/
    2.0/
      back_end/
      front_end/
    ...
    trunk/
      back_end/
      front_end/

So I'm trying to set the git repo's trunk as the branches/releases/trunk folder, and the branches as each of the versioned folders within the branches/releases/ directory. My commands are:

git svn init -T /branches/releases/trunk --branches="/branches/releases/{1.0,2.0}" [repo_url]
git svn fetch --authors-file=authors.txt

This is almost working as intended, and the trunk looks to be correctly migrated. However the remote branches that are created to mimic the svn branches are divided up into each subfolder (front_end, back_end). Looks like this when running git branch -r:

origin/1.0/front_end
origin/1.0/back_end
origin/2.0/front_end
origin/2.0/back_end
origin/trunk

Does anyone know why the branches might be separated like this?

CodePudding user response:

In git svn option --branches doesn't list branches, it lists the parent directory under which Subversion stores subdirectories that imitates branches in SVN. Given the structure above option --branches="/branches/releases/{1.0,2.0}" creates 4 branches: 1.0/front_end, 1.0/back_end, 2.0/front_end, 2.0/back_end. That's exactly what you see.

If you want just 2 branches 1.0 and 2.0 the option should be --branches=/branches/releases/. Then every of these 2 branches will have 2 subdirectories front_end and back_end, exactly like the trunk.

  • Related