Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-svn branching: how to configure git config

a few months ago i configured a git with an svn repository. Until now i only used the svn repository to keep up-to-date with the supplied application on it. But now i also want to commit stuff back. To do this every feature i'm going to commit needs to be in a separate branch. I read about how you should create a new branch etc. But i think i mis-configured my git, i don't have any branch information etc i think i only have the trunk info. This is how my svn repository has been set up in my git config:

[remote "origin"]
    url = url-of-git-repository
    fetch = +refs/heads/*:refs/remotes/origin/*
[svn-remote "svn"]
    url = url-of-svn-repository/trunk
    fetch = :refs/remotes/git-svn
[branch "master"]
    merge = refs/heads/master
    remote = origin
... other branch information below (these are git branches)

Now as you can see my svn-remote url goes directly to trunk. I read about adding this:

branches = branches/*:refs/remotes/*

but when i create a new branch then it will be adding it to trunk/branches/. When i don't add the line then it doesn't know what the destination is of the branch.

Any idea how to solve this without breaking the existing branches, code, etc.?

greets, Daan

like image 442
Daan Poron Avatar asked Jul 20 '10 12:07

Daan Poron


People also ask

Can you use git and SVN together?

git-svn is a specialized tool for Git users to interact with Git repositories. It works by providing a Git frontend to an SVN backend. With git-svn, you use Git commands on the local repository, so it's just like using normal Git. However, behind the scenes, the relevant SVN commands are sent to the server.

Does SVN support branching?

Subversion Branching StrategiesSubversion branches (SVN branches) allow your team to work on multiple versions of your code simultaneously. Developers can test out new features without impacting the rest of development with errors and bugs. SVN's “branch” directory runs parallel to the “trunk” directory.

Does Tortoise SVN work with git?

TortoiseGit Is an easy to use gui-based git client for windows. With the included git-svn module it is also possible to use subversion repositories. If you use git locally, you can use all git features like stashing and local branches but still use the subversion repository.


1 Answers

I believe the branches configuration is relative to the svn-remote url.

Here's our configuration the way it was made by doing

git svn -s url-of-svn-repository/foo

(Inside the folder foo, we have the normal trunk/branches/tags structure)

[svn-remote "svn"]
        url = url-of-svn-repository
        fetch = foo/trunk:refs/remotes/trunk
        branches = foo/branches/*:refs/remotes/*
        tags = foo/tags/*:refs/remotes/tags/*

You could try adjusting to this structure, or do your git svn clone over again with the -s parameter. It will configure all this for you (--standard-layout).

like image 51
Thomas Ferris Nicolaisen Avatar answered Sep 24 '22 16:09

Thomas Ferris Nicolaisen