简体   繁体   中英

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

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).

This was a post that helped me get git working with svn with a project that had a very unorthodox branch stucture (which is par for the course for companies using SVN for some reason I'm afraid).

http://www.dmo.ca/blog/20070608113513/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM