开发者

How to make an existing git branch track a remote SVN branch?

开发者 https://www.devze.com 2023-01-08 04:44 出处:网络
Similar to this question开发者_JS百科, how can I make an existing Git branch track a remote SVN branch?

Similar to this question开发者_JS百科, 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消