I have an SVN repository that I'm converting to a Git repo using git svn
. The process does not consistently convert SVN branches to Git branches, and I'm trying to figure out why.
I start with an SVN repo in the directory svn_source/
. This is a proper repo, not a working copy. If I checkout a working copy into svn_wc/
, I can list its branches explicitly:
~$ svn checkout file://~/svn_source/ ~/svn_wc/
~$ cd svn_wc/
~/svn-wc$ ls -A1h branches/
1.0
1.1
1.2
1.3
2.0
3.0
3.0-alpha
3.0-beta
3.1-test
When I then use git svn clone
to clone the SVN repo (not the working copy) into a full Git repo,
~$ git svn clone --stdlayout --no-metadata file://~/svn_source/ ~/git_full/
only three of the SVN branches are converted into remote branch references under ~/git_full/.git/refs/remotes/origin/
:
~/git_full/.git$ tree refs/
refs/
├── heads/
│ └── master
├── remotes/
│ └── origin/
│ ├── 2.0
│ ├── 3.0-beta
│ ├── tags/
│ └── 3.1-test
└── tags/
5 directories, 4 files
Why are only these three converted? I've run the git svn clone
three times, and it's always these. There's nothing special about them that I know of.
Your tree refs/
command might not show all refs because git eventually packs them into the file .git/packed-refs
. This is explained in the git pack-refs manual:
Traditionally, tips of branches and tags (collectively known as refs) were stored one file per ref in a (sub)directory under $GIT_DIR/refs directory. While many branch tips tend to be updated often, most tags and some branch tips are never updated. When a repository has hundreds or thousands of tags, this one-file-per-ref format both wastes storage and hurts performance.
To show everything use either
git show-ref
or git for-each-ref
.