Dean
Dean

Reputation: 9108

Create a svn branch from git when directory structure differs

I created a local git copy of an svn repo with the following commands:

$ git svn init svn://host/path/to/repo/PROJECT/trunk workingcopy
$ cd workingcopy
$ git svn fetch

Now I'm trying to create an svn branch without success:

$ git svn branch -n mybranch -m "Branch for my things"
Multiple branch paths defined for Subversion repository.
You must specify where you want to create the branch with the --destination argument

In .git/config I do not have any entries under [svn-remote "svn"] as suggested in this answer. I tried adding branches = branches/*:refs/* but this tries to create the branch under the trunk:

Copying svn://host/path/to/repo/PROJECT/trunk at r6684 to svn://host/path/to/repo/PROJECT/trunk/branches/mybranch

What do I need to do to create a branch in the correct location?

Upvotes: 2

Views: 945

Answers (1)

Dean
Dean

Reputation: 9108

Okay, so I changed .git/config from:

[svn-remote "svn"]
    url = svn://host/path/to/repo/PROJECT/trunk
    fetch = trunk:refs/remotes/git-svn

to:

[svn-remote "svn"]
    url = svn://host/path/to/repo/PROJECT
    fetch = trunk:refs/remotes/git-svn
    branches = branches/*:refs/remotes/*

This worked, but I ran into problems trying to access the branch from a git repo on another machine. In the end, I pushed my changes to svn, then deleted my local git repo and cloned it properly this time:

$ git svn clone --standard-layout --prefix=svn/ svn://host/path/to/repo/PROJECT

Upvotes: 2

Related Questions