Go read those if you're interested in yet-another-opinion about sourcecode management :-)
I'm interested in developing with git against a subversion repository which holds the main body of code for whatever reason: company politics, historic reasons, need for a centralized repository, whatever.
This is in fact very simple with the git svn wrappers, it's trivial to create a git-repository which is based on a subversion repository AND stays in sync all the time as well.
Please read: http://www.viget.com/extend/effectively-using-git-with-subversion/ for a nice overview.
What is not much covered is setting up a git repository based on a non-standard subversion layout. I searched around on the net using google and couldn't find a good description.
And guess what I had :-(
I've setup a git repository for a subversion repository which had a non-standard layout for historic reasons. It was way too much trouble to reorganize the subversion repository so I decided to make the git repository match the subversion repos.
The subversion is layed out like this:
/
/trunk
/stable
/branches/virtual
/branches/redesign
/josephs_stuff
/tryout1
/tryout2
Basically the stable branch was started not inside a branches subdir as is standard but on the root of the repository. Later on someone realized that a branches subdir was a good thing to have and added it.
Ideally I'd like to have all branches that are relevant to me as a branch inside git.
The branches I'm interested in are: trunk, stable, virtual and redesign, the rest is just old cruft, left there for no specific good reasons.
I've inited the git repos with the following command:
git svn init --trunk trunk https://svn.server.not/svn/ git-repos
Afterwards I needed to add the other three branches, you need to edit you git config file for this which you can find in:
git-repos/.git/config
The relevant part of my git config looks like this:
[svn-remote "svn"]
url = https://svn.server.not/svn/
fetch = trunk:refs/remotes/trunk
fetch = stable:refs/remotes/stable
fetch = branches/virtual:refs/remotes/virtual
fetch = branches/redesign:refs/remotes/redesign
After saving my git config it's time to actually pull in the subversion content:
git svn fetch
That's it.... now you have a fully functional git repository with branches for the different "branches" in your old and crufty subversion repository.
The format appears to be:
url = $SVN_BASE_URL
fetch = $SVN_DIR:refs/remotes/$GITBRANCHNAME
I'd think twice before I'd deviate the git branch-names from the subversion branch names.
Happy hacking.