Using git-svn with remote branches

Posted by mhagedorn on April 20th, 2011 filed in git

I am writing this as a note to myself, because I always forget how to set this up.   I have found it surprisingly hard and tricky to get  local git branches to map to remote svn branches.   Not sure why this is really, but have put together these notes as to how to get it to work “normally” from the git side and magically map to the appropriate remote branch on the remote svn side.

Assume your upstream svn repo is stored at

First clone the repo: git svn clone –stdlayout

(stdlayout tells the git svn client to assume the existence of trunk, branches and tags in the upstream repo, most people do this)

after it finishes you will have a directory myproject with trunk checked out in it

git branch -r will show you the upstream (svn) branches

working on a remote branch is as easy as git checkout  -b newlocalbranch nameofremoteupstreambranch

you can see which upstream branch is connected to the local git branch by doing a git log

Leave a Comment

You must be logged in to post a comment.