4

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?

Community
  • 1
  • 1
Phillip B Oldham
  • 17,339
  • 17
  • 83
  • 127

1 Answers1

3

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.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283