How to clone a nonstandard svn repo to git?
$ git clone svn://url/svn-root -T trunk -b branches -b branch1 -b branch2
$ git clone svn://url/svn-root -T trunk -b branches -b .
Both are failed to clone the
branch2 correctly. Please help.
svn-root ├── branch1 ├── branch2 ├── branches │ ├── branch3 │ └── branch4 └── trunk
2 Solutions collect form web for “How to clone a nonstandard svn repo to git?”
One interesting tool, mentioned in GitMinutes Episode 20, is SubGit, a plugin for Atalssian Stash (which isn’t free, but you can try it for free).
You can know much more about SubGit in “GitMinutes #22: Alexander Kitaev about SubGit”.
It is designed to managed unconventional svn repo layout.
Dmitry Pavlenko comments:
you should enter in the “Branches” field:
*:refs/heads/*;branches/*:refs/heads/branches/* # instead of branches/*
In this case
branch1will be translated to
Alternatively, if you have limited number of top-level branches, you can enumerate them explicitly:
branch1:refs/heads/branch1; branch2:refs/heads/branch2; branches/*:refs/heads/branches/*
Two options come to mind:
- Clean up your SVN repo first (Move branches below /branches, where they should be according to standard layout).
- Checkout using standard layout, add remote branch refs later on.