Search code examples
gitgit-svn

Adding another directory for branches in git-svn


According to this question, you can edit your .gitconfig and tell git-svn where to go about to push your latest code change.

In my case, I have a special case where nor the Tags and nor the Branches can be used. So, if you look at the SVN repo, you see something like this:

trunk
branches
tags
xtra

I am new to git-svn and up to know I was fine with working directly with the trunk. Things changed and I need to work with xtra folder and create subfolders in there e.g. xtra/Job1234/ and push into it. How can I do such change ?

If I type git svn info, I get:

URL: https://some.net/repositories/myproject/base/trunk

Clearly, any git svn dcommit pushes things to the trunk. Any leads ?


Solution

  • Try this:

    $ git config --add svn-remote.svn.branches "xtra/*:refs/remotes/xtra/*"       ①
    $ git svn branch -d xtra Job1234                                              ②
    $ git checkout --track remotes/xtra/Job1234                                   ③
    

    ... and you should be ready to commit!


    Yes, you can also do the equivalent of ① by directly editing .git/config.