How can a large SVN repository (several GBs) with hundreds of branches be migrated to a Git repository? Not looking for them to work side by side, just a way to get rid of SVN.
From some experiments I've done with git svn
it's not clear how to specify a complex branch hierarchy. Especially when branches often get deleted in SVN...
Here's an example of the sort of hierarchy I'm talking about:
trunk/
tags/
vendors/boost/
branches/ProjectA/
branches/ProjectA/MajorVers开发者_运维问答ion/
branches/ProjectA/MajorVersion/MinorVersion/
branches/Experimental1/
branches/RecycleBin/OldDiscardedBranch
The point being that a simple regex or wildcard cannot capture the correct location of all branches.
Is there a way to feed all these branch location information to Git? What will git-svn do when it tries to migrate a revision that belongs to a deleted branch?
I've been looking at doing similar things with a different repo. The end result of my thinking and playing is that you need to do a few things:
- Use
git filter-branch
to do rewriting from some projects to another. IE, usegit filter-branch
to rename everything in a sub-directory to a parent. In my case, I have multiple modules under trunk and I'm using filter-branch to move everything inside one directory to the top. - Do this for each branch as well, but also delete any branches that don't pertain to a particular project
That way in the end you'll have multiple git
repos that contain only one project per repo (the way it should be).
If the branching/tags directories are complex, the git svn clone
command will let you specify multiple tag and branch directories using a comma (if I recall).
Also, run git gc --aggressive
after you've finished extracting everything to shrink the repo size a bit.
精彩评论