Git and SVN: connecting git branches to svn branches
April 28, 2008
Currently working on a project where Subversion is the CM system of choice. I'd like to use git, as it's faster and doesn't require so much network access. Plus, I'm hoping when it comes time to merge, I can simplify the entire process by using git's allegedly superior merging technique. At any rate, I've got a branch on SVN to work on, and I want to track both that branch and the entire svn tree.
Saturday morning, I did a git-svn init from their repository. Today, after lunch, it finished. After doing a git-gc to clean up the checkout, it wasn't clear how to connect branches. Following is what I did (assume my subversion branch is branches/FOO):
The first thing creates a new branch called "local-trunk" started at "trunk" (which is the remote branch mapping to the subversion main trunk). The second command creates a new branch called "local-foo", which is rooted at remote branch "FOO". I have no clue why I couldn't do the same thing twice, as both commands seem to do the same thing (the first switches to the branch "local-trunk" after creating it). But, this is what worked for me.
Now, to develop, I git checkout local-foo and commit all day long. a git-svn dcommit will send my changes to subversion on the FOO branch. I can update the trunk via git checkout local-trunk and git-svn rebase. My hope is that I can merge from the trunk to my branch periodically and then, when my code is merged to the trunk, things will be pretty much done and ready to go. We'll see.
On a side note, the git repository, which contains every revision of every file in the subversion repository is 586,696 bytes. The subversion checkout of just the FOO branch is 1,242,636 bytes; over double the size, and there's still not enough info in that checkout to do a log or diff between versions.