git svn master to branch to master - 仍尝试提交分支

时间:2011-06-28 16:05:28

标签: svn git git-svn

我关注如何使用git svn创建和签出分支的this帖子,以便在svn repos上实际创建分支。这很有效。

当我完成了我的分支时,我对主人进行了结账并进行了git合并。这很好。然后我将合并提交回svn repos上的trunk,所以发出一个git svn dcommit。

它试图承诺分支。即使我现在检查了主分支。我错过了什么?

$ git svn branch -m "test branch" test_branch
$ git checkout --track -b test_branch remotes/test_branch
$ Hack hack hack...
$ git svn dcommit --dry-run    # Make sure you're committing to the right SVN branch
$ git svn dcommit              # Commit changes to "test_branch" branch in SVN
$ git checkout master
$ git merge test-branch
$ git svn dcommit # why is this committing to the branch instead of trunk??

这是我的.git / config以防万一

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[svn-remote "svn"]
    url = mysvnrepos.com/svn/project
    fetch = trunk:refs/remotes/git-svn
    branches = branches/*:refs/remotes/*
[branch "test_branch"]
    remote = .
    merge = refs/remotes/test_branch

1 个答案:

答案 0 :(得分:0)

我以为有人问过这个,但我再也找不到了。无论如何,带分支的git-svn很复杂。您必须在svn端创建空分支,git svn branch或普通svn mkdir。然后你用git检查那些分支,并在不使用git级别合并的情况下在它们之上提交rebase。这样,git分支在其祖先中指示了正确的svn分支,并且dcommit提交到正确的分支。您可以验证分支git-svn是否会使用git svn info