Search code examples
gitgit-svnsourcetree

How to push two git branches to seperate svn repositories? Especially using sourcetree


I have a local git repositories which initialized with

git svn init http://abc.xxx/svn/trunk/topic_A

And then I create a local branch topic_B, and want to put it under the svn URL http://abc.xxx/svn/branches/topic_B. The svn branch is created with svn client. So I don't need to create svn branch in git.

How should I modify the .git/config file to add this?

I have tried to add with:

[svn-remote "topic_B"]
url = https://abc.xxx/branches/topic_B/
fetch = :refs/remotes/topic_B

[branch "topic_B"]
remote = .
merge = refs/remotes/topic_B

However when using git from the console, git commit always choose the trunk URL as the push destination?

And in sourcetree, the GUI seems to have difficulty to fetch the newly added remote svn branch.

And it seems there is noway you can change the push destination of subversion.

Any one can figure out a correct way? Thanks a lot!


Solution

  • You can simply rename the [svn-remote "topic_B"] to a different name so there will be no collision.

    And it seems there is noway you can change the push destination of subversion.

    Another option is to set it VIA command line instead of the config file:

    git config --add svn-remote.topic_B.url ...
    git config --add svn-remote.topic_B.fetch :refs/remotes/topic_B
    

    This will generate the same output as you have in your question.