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

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?

-------------Problems Reply------------

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.

Category:git Views:0 Time:2010-07-22

Related post

  • Make an existing Git branch track a remote branch? 2009-02-06

    I know how to make a new branch that tracks remote branches, but how do I make an existing branch track a remote branch? I know I can just edit the .git/config file, but it seems there should be an easier way. --------------Solutions------------- Giv

  • How to tell which remote svn branch is a local git branch tracking? 2011-02-09

    I'm a bit confused about how to commit on several svn branches from different local git branches. In particular, even though I've read many of the relates questions on this topic, there's one specific thing that nobody seems to have explained so far:

  • Git: How to commit into SVN branch after rebase? 2010-02-17

    I have a problem with a SVN branch. I made a checkout of it with git checkout -t -b stable svn/stable. Then I did a merge with git rebase master. After that I tried to commit the merge changes into the remote branch with git svn dcommit But now it se

  • Can I use git-svn to clone a specific branch of a remote SVN repo and commit back to it? 2012-04-10

    I have a very large codebase with many tags and branches on a remote SVN server. I'd like to use git to clone a specific branch to work on, then eventually merge it back to the remote SVN. Is this possible? Most documentation I've seen doesn't direct

  • How do I make a local branch track a remote branch with a different name? 2010-08-29

    I have a setup with two servers (staging and production). Both of these has a master branch I can push to (I use heroku, not that it matters though). Currently, I can push to staging with this command: git push staging master Which will push my local

  • how to check a local branch tracking which remote branch? 2012-01-12

    I want to check a local branch currently tracking which remote branch For example: git checkout -b test_branch git branch --set-upstream test_branch origin/remote_project001 But after a few days, I forget which remote branch test_branch is tracking.

  • GIT bare with a remote SVN reference. How I update? 2011-09-07

    I have a bare git repository with a remote reference to a SVN repository. Also I have a cloned repository from this. I want to have this bare repository always synchronised, I'm doing a git svn fetch, but when I execute a git log I can not see the re

  • Can I use git to track public and private branches that intentionally diverge? 2011-12-18

    Say I have: X Z o-----o----o-----o---o A \ / \ / o------o---------o B Y Suppose that A and B intentionally diverge, because (say) A is a public branch and B is a company-internal branch (which needs to have some differences for technical reasons and

  • How to switch svn branches using git-svn? 2009-04-08

    Duplicate How do I make git-svn use a particular svn branch as the remote repository? I am using git-svn to track development by someone else on svn. I'm trying to figure out how to use gti-svn to switch from one svn branch to another. All the exampl

  • Track all remote git branches as local branches 2008-12-18

    Tracking a single remote branch as a local branch is straightforward enough. $ git checkout --track -b ${branch_name} origin/${branch_name} Pushing all local branches up to the remote, creating new remote branches as needed is also easy. $ git push -

  • Git - How to track a remote branch that you created from a local branch? 2010-11-08

    Here's the scenario. I have a series of commits in branch my_new_branch I want to push this branch up to the remote repo as a different name and track it. If I do: git push origin my_new_branch:different_name it pushes the branch up fine. But if I st

  • Create an SVN branch from an existing Git branch 2011-03-11

    I have cloned an existing SVN project via git svn clone with no problem so far, but in the mean time I have created a branch in Git only (not in SVN) and now i would like to synchronize this branch back to an SVN branch (not the trunk). I have create

  • Difference between git checkout --track origin/branch and git checkout -b branch origin/branch 2012-04-03

    Does anybody know the difference between these two commands to clone and track a remote branch? git checkout -b branch origin/branch git checkout --track origin/branch I think both keep track of the remote branch so I can push my changes to the branc

  • Git - track multiple remote branches? 2010-12-27

    So let's say there are three developers: Alice, Bob and Cecil. They decide to use Git without a central repo. They all setup remotes to each other, so that: * Alice has remotes/bob/master * Alice has remotes/cecil/master * Bob has remotes/alice/maste

  • Git Pushing from a local branch to a remote tracking branch 2011-07-01

    I have a master branch and branched out from it to a build branch. I cloned this repository to a different machine. I created a branch my_build to track the remote build branch. Now i have few commits made in my_build branch. I want to push these cha

  • Git: local branchs tracks other local branch 2012-02-13

    I know that local branches can track remote branches, but there is also the possibility that a local branch tracks another local branch. What is a use-case for this? --------------Solutions------------- Real-world use: I have an upstream repository,

  • Pushing an existing git repository to SVN 2009-03-19

    I've been doing all my work in Git and pushing to GitHub. I've been very happy with both the software and the site and I have no wish to change my working practices at this point. My PhD adviser is asking all students to keep their work in an SVN rep

  • Add a new subversion remote into existing Git repository 2010-12-06

    I have a git repository fully tracking a remote SVN repo. Now I need to add a new branch that will be tracking a directory in a completely different SVN repo. Is that possible? --------------Solutions------------- It is. git svn init only edits the d

  • git-svn cannot create a branch to follow SVN branching 2011-01-09

    I'm struggling with the following issue. When I continue fetching revisions from SVN with git svn fetch I'm getting the following error: Found possible branch point: =>

Copyright (C), All Rights Reserved.

processed in 0.098 (s). 11 q(s)