Solution for moving SVN from branch to trunk

43 views Asked by At

I am attempting to use a git svn clone to move my SVN repo over to Git, whilst preserving the history. I know that Git SVN clone works for me as I have tried it with a simple test SVN repo.

The problem that I have is that the SVN repo does not have a trunk directory and all of the code is in a /branch directory (not /branches). git svn clone is returning an error as no /trunk directory is available.

So my question is, how do I move the content in my SVN /branch directory into /trunk whilst preserving the history?

2

There are 2 answers

1
eftshift0 On

If you are using default layout for git init (which I think is the default in git-svn, though I might be wrong on that assumption), then git-svn will fail if that is not the case.... however, you can pinpoint separate branches by using -T or --trunk when calling git svn init. Check https://git-scm.com/docs/git-svn

0
Boomfelled On

I managed this in the end by following the combined advice posted by everyone above. Thanks very much.

I removed all of the flags that are suggested in the documentation and managed to get hold of my /branch directory by including that in the URI. This worked for me as I'm not actually including any branches or tags, so it's quite simple. A more complex svn structure would be a different kettle of fish.

git svn clone https://uri/svn/branch