Reluctantly, I’ve had to migrate some projects back to Subversion. Thankfully git-svn is great. It even follows Subversion branches as local git branches, making merging painless. Here’s how you create a git branch from an svn branch:
git checkout -b localbranchname remotebranchname
Obviously it assumes you’ve initialised the git repo correctly and you’re using all the defaults. Something like this:
git svn init -s http://path.to/repo projectname
cd projectname
git svn fetch
Update: merging a Subversion branch with Subversion trunk (aka Git master) is a pain. A real merge is not possible; but a squashed commit works. This is what I prefer since we try to keep Svn branches pretty small and the history is retained in Subversion anyway.
git checkout remotes/trunk -b big-merge
git merge –squash svn-branch
git commit
When that’s done I can safely merge the two Git branches:
git checkout master
git merge big-merge
git svn dcommit