繁体   English   中英

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

[英]git svn master to branch to master - still tries to commit to branch

我关注了这篇关于如何使用 git svn 创建和签出分支的帖子,以便该分支实际上是在 svn 存储库上创建的。 这很好用。

完成分支后,我在 master 上进行了结帐并进行了 git 合并。 这工作得很好。 然后我将合并提交回 svn 存储库上的主干,因此发出 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??

这是 my.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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM