views:

38

answers:

1

Similar to this question, how can I make an existing Git branch track a remote SVN branch?

I often find that I start work in a local branch that I then need to push to an SVN server. Is this possible?

A: 

The idea remains to push to an existing SVN branch.

Meaning you need:

  • to git svn rebase an existing SVN branch (called here 'git-svn-branch')
  • git branch -b work # new working branch
  • work...
  • git checkout git-svn-branch and git svn rebase (make sure master is up-to-date)
  • git checkout work and git rebase git-svn-branch (replay your work on top of the git-svn branch)
  • git checkout git-svn-branch and git merge work (update git-svn-branch HEAD to work HEAD)
  • git svn dcommit (push back the git-svn branch to SVN repo, with work commits included in it)

You will find that same process in this SO question.

So, in short, when you are working on a local Git branch, and you want to push it to an SVN branch, you need first to import that SVN branch to a 'git-svn' local branch, and then rebase/merge your local branch on it.
You cannot directly push your local Git branch on an SVN remote one.

VonC