2009-08-23 37 views
6

我与被奠定了这样一个SVN仓库工作:混帐SVN不承诺分支,只有主干

 
$SVN/[project]/trunk 
$SVN/[project]/branches/[user]/[branch] 
$SVN/[project]/tags/releases/[tag] 

我的.git /配置是这样的:

 
[svn-remote "svn"] 
    url = $SVN 
    fetch = project/trunk:refs/remotes/trunk 
    branches = project/branches/*/*:refs/remotes/* 

当我看着git分支-a,我看到所有的远程分支。比方说,我想检查一个,处理它,然后再提交更改。这里就是我想要做的事:

 
git checkout -b comments erik/comments 
.... work, commit locally .... 
git svn dcommit 

然而,dcommit总是推到$ SVN /项目/主干。 git svn info总是报告URL为$ SVN/project/trunk

我试过使用--track,我试过用-hard重置。我在这里没有想法。我怀疑这是我的[svn-remote],但这只是一种预感。

回答

0

您可以尝试svn2git, and git2svn,因为它们会考虑到非标准的SVN布局。

他们确实使用的git svn--tags--branches参数,即使你不使用我上面提到的脚本,您可以使用这些参数,以获得在你的svn库在正确的地方的数据。

1

分支erik/comments已经存在于SVN中了吗?

我的工作方式如下:

git svn fetch #update any newly created branches 
git checkout davec/new-feature # on remote branch, git may warn you 
git checkout -b new-feature davec/new-feature # assumes this exists in SVN 
# hack 
# commit 
git svn dcommit 

我意识到git checkout -b local remote是什么,我在两个步骤做的一步版本,然而,这似乎工作。

另一种选择是用您的用户名替换您的配置,例如,

branches = project/branches/erik/*:refs/remotes/* 

然后

git checkout new-feature # remote branch 
git checkout -b new-feature-branch # local