目录结构不同时,从git创建一个svn分支

时间:2013-07-04 23:40:36

标签: git-svn

我使用以下命令创建了svn repo的本地git副本:

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

现在我正在尝试创建一个svn分支但没有成功:

$ 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

.git/config [svn-remote "svn"]中,branches = branches/*:refs/*建议Copying svn://host/path/to/repo/PROJECT/trunk at r6684 to svn://host/path/to/repo/PROJECT/trunk/branches/mybranch 下没有任何条目。我尝试添加{{1}},但这会尝试在主干下创建分支:

{{1}}

在正确的位置创建分支需要做什么?

1 个答案:

答案 0 :(得分:2)

好的,我改变了.git/config

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

为:

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

这很有效,但是在尝试从另一台机器上的git repo访问分支时遇到了问题。最后,我将我的更改推送到svn,然后删除了我的本地git repo并且这次正确克隆了它:

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