我想使用git svn跟踪Subversion存储库中的两个远程分支。怎么样?

php*_*uru 5 svn git version-control git-svn

我整天都在尝试基于非常大的远程Subversion存储库在本地手动配置git存储库。它具有默认配置(主干,分支,标签),但是我只需要一小部分数据。

我没有完全理解.git / config中Git的:refs / remotes / *语法,即使许多在线帖子都包含有关编辑和获取的说明。

我将我的svn存储库存储到$SVNR环境变量中。大约等于 https://svn.ourserver.com/svn/

我想要一个git master分支来跟踪$ SVNR / branches / production和一个development分支来跟踪远程svn中继。

我有一个庞大的仓库,只希望进行一些修订,并将git仓库构造为远程SVN仓库的较小子集,就像这样。在许多其他网站和有关此操作的帖子之后,就我的克隆命令而言,我最终得到了这一点:

git svn clone -r2000:HEAD --prefix=svnrepo/ --authors-file=/Users/phpguru/Sites/authors.txt $SVNR/branches/production gitrepo

现在我可以cd gitrepo看到我的.git/config

[svn-remote "svn"]
    url = https://svn.ourserver.com/svn/projectfoo/branches/production
    fetch = :refs/remotes/svnrepo/git-svn
[svn]
    authorsfile = /Users/phpguru/Sites/authors.txt
Run Code Online (Sandbox Code Playgroud)

现在,让我们暂时分开。为什么不在master这里列出?哪里git-svn来的?这在我的SVN存储库中不存在。我不明白为什么提取引用没有说fetch = master:refs/remotes/svnrepo/branches/production?如许多示例所示,我可以将“ svn”更改为“ projectfoo”吗?

当我做一个git svn infogit branch -a我确实看到一个主分支。看来master可以正确地跟踪我想要的分支/生产。

我的问题是,我现在该如何创建一个 development跟踪远程干线分支?

我尝试了十二种不同的方法,包括使用一些逻辑提取行来编辑.git / config:

fetch = branches/*:refs/remotes/svnrepo/branches/*
fetch = development/*:refs/remotes/svnrepo/trunk/*
Run Code Online (Sandbox Code Playgroud)

但没有任何效果。

$ git branch --track development remotes/svnrepo/trunk
error: the requested upstream branch 'remotes/svnrepo/trunk' does not exist
hint: 
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint: 
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
Run Code Online (Sandbox Code Playgroud)

要么,

$ git branch development --track remotes/git-svn-trunk
fatal: Cannot setup tracking information; starting point 'remotes/git-svn-trunk' is not a branch.
Run Code Online (Sandbox Code Playgroud)