1

Several of the SVN repositories I need to migrate show a very messy layout. Most of them, I figured out how to convert them, but one is bugging me and I don't find an answer on the net.

The SVN repository has this folder strucutre:

/trunk/src
/trunk/doc
/trunk/tools/toolA
/trunk/tools/toolB
/toolX

The question is, how do I get this into GIT master branch like:

/src
/doc
/tools/toolA
/tools/toolB
/tools/toolX
PirklW
  • 484
  • 2
  • 16
  • Is there really nobody able to answer? – PirklW Jun 11 '19 at 17:12
  • Have you considered doing a standard import, and then doing `git mv` on all the files? – joanis Jun 20 '19 at 14:32
  • so I'd have to import the project with `--trunk /` and get a completely flat layout? Because of course there are still `/branches/branchA` `/branches/branchB` as svn copies from `/trunk` – PirklW Jun 21 '19 at 07:59
  • Sorry, I've seen conversions from CVS, but not from SVN. I would have assumed, like it did for CVS, that an automated conversion tool should put trunk into the master branch, and SVN branches as Git branches coming off of master at the equivalent point to where they branched off trunk in SVN. Once in Git, all the `trunk` and `/branches/branchX` structure should disappear, since that's not how Git manages branches. If that's not what happens, I would not know how to proceed. The limitation of my `git mv` suggestion is that you would have to do it separately in each branch; maybe not so great. – joanis Jun 21 '19 at 17:48

1 Answers1

1

so I'd have to import the project with --trunk / and get a completely flat layout?

No, it would be better to do a classic import, getting a repository with /trunk/src instead of src in it.

Then, with a git filter-branch, as shown here (2016) or even here (2011), you can mv/rename those files in order to remove any /trunk/ in their path.

This is of course valid for one-shot import, not for two-way import/export, where you still want later to git svn dcommit data back to the original SVN repository.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250