My normal git-svn workflow is to do my work on a local branch, then merge to master and git svn dcommit from there to record my commits onto the svn trunk.
However, in my current local branch (foo) I’m realizing that this work is going to be around for a while before I feel comfortable committing it to the trunk, and other developers might be involved in it before then. I would like to “back it” by a svn branch, so that my work is on the server.
I’ve created a new svn branch (svnFoo) from the current trunk and I basically want to “move” foo so that when I svn dcommit from it all of its commits get recorded on svnFoo instead of trunk.
What is the best way to do this?
git rebaseis your friend here. Assuming you created the localfoobranch from the localmasterbranch, and you’ve done a recentgit svn fetchso your local Git repository knows about the remotesvnFoobranch, the magic command you want is this:This will find the commit where you branched
foofrommaster, and replay all the commits from there to the head of thefoobranch on top of thesvnFoobranch. Subsequentgit svn dcommits will commit onto the SubversionsvnFoobranch rather than the trunk.