I used the following command to clone svn repo into git and after executing it, i see some spurious branches.
git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp
git branch -a
*(no branch)
master
remotes/abc-1.3.x
remotes/abc-1.3.x@113346
remotes/abc-1.3.x@541512
remotes/branch_test_script
remotes/tags/modules-1.2
remotes/tags/modules-1.2@113346
remotes/tags/modules-1.2@516265
remotes/tags/release-1.1
remotes/tags/release-1.1@113346
remotes/tags/release-1.1@468862
remotes/trunk
Actual branches created in svn were abc, branch_test_script, modules and release.
Can someone help in understanding what ‘abc-1.3.x@113346’ , ‘abc-1.3.x@541512’ … ‘release-1.1@468862’ etc are ?
How can we get rid of these spurious branches / what do they signify ?
Thanks,
Gayathri
tl;dr:
git svncreates these “@”-branches if a branch (or tag) was created for a subdirectory (or for another directory which is not tracked by git-svn). There will always also be a “regular” branch with the same name, but without the “@” suffix. The “@”-branch only exists as a branching point for the regular branch.Note: I submitted a patch for this; an edited version of this explanation is now part of the official
git svnmanpage, as a new section “HANDLING OF SVN BRANCHES” (since Git 1.8.1).In Subversion, branches and tags are just copies of a directory tree, so it’s possible (though usually discouraged) to create a branch from a directory that is not itself a branch (or trunk). For example, by copying /trunk/foo to /branches/bar, instead of copying /trunk (a “subdirectory branch”, so to speak), or by copying a directory that lies outside the trunk/tags/branches structure (which is possible in SVN).
In git, however, a branch is always for the whole repo, subdirectory branches do not exist.
git svntherefore uses a workaround. If it detects a branch that was copied from a directory that is not itself tracked as a branch by git-svn, it will create a new history. For example, for a subdirectory branch where /trunk/foo is copied to /branches/bar in r1234, it will create:trunk), and the new ones.In that way, for the subdirectory branch bar, you get two branches in git
I’m not quite sure why this dummy branch is created. I think it is done to represent the information about which revision the branch was branched from, and to have a complete history for the branch.
Note that this whole mechanism can be switched off by using the flag
--no-follow-parent. In that case, each SVN branch will result in a git branch with just the commits from the SVN branch directory. Each branch will be unconnnected to the rest of the history, and will have its own root commit, corresponding to the first commit in the branch.