Last Updated: February 25, 2016
· oz123

Working with git and subversion branches

I don't care so much which SCM I have to use, but the fact that git is so popular makes a whole ecosystem around it. Unfortunately, with SVN I feel like I belong to an extinct race. So, too get over this hurdle, I use git svn.
When ever I clone a repository I follow the following path:

$ git svn clone svn://servervcs/Project/ -T trunk -b branches -t tags --prefix=origin
$ cd Project

Now, I create a remote branch on SVN with:

$ git svn branch -m "create branch for working on feature" feature_branch

Next, I create a local branch that tracks this remote branch:

$ git checkout -b local/feature_branch origin/feature_branch

Well, now we can do so work, and commit it to the remote branch:

  [local/feature_branch]  $ git svn dcommit

   Committing to svn://servervcs/Project/branches/feature_branch ...
A   test
   Committed r19310
A   test
   r19310 = c3a343196ba0f429b49dacd9b0719ab9214a3a2d (refs/remotes/feature_branch)
   No changes between 1763f525c27350cbc5aaa72df795b52d091392be and refs/remotes  /feature_branch
   Resetting to the latest refs/remotes/feature_branch
Say Thanks

2 Responses
Add your response


I have the following two .. adjustments .. to the above.

git svn clone svn://servervcs/Project/ -T trunk -b branches -t tags --prefix=origin/

git checkout -b local/feature_branch origin/feature_branch

Nice intro to git svn .. never let svn keep you down! :-)

over 1 year ago ·

@klang, awesome!

over 1 year ago ·
Filed Under