Thursday, 16 September 2010

git-svn: a short summary in branching

When it comes to branching with git-svn my opinion is that it is best to keep all your branching local in git and track a single remote svn branch with your local master branch. If this cannot be achieved (e.g some remote svn branches already exist and you need to track them) then the following might help.

Creating branches:

To create both local and remote branches with git-svn, we need to create the remote branch and then track it with a local branch. Avoid ambiguity by using different names for your local and remote branches:



Deleting branches:

To delete branches, handle the local branches with git and the remotes ones with svn. You will also have to delete the references to the remote branches otherwise they keep showing up when you list all your local and remote branches:



I am sharing these notes because I've been through all this before and forgot how I achieved it last time! Furthermore this seems like something that can and probably has already been automated. I would like to know either way ;)