简体   繁体   English

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

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

I followed this post on how to create and checkout a branch using git svn so that the branch was actually created on the svn repos.我关注了这篇关于如何使用 git svn 创建和签出分支的帖子,以便该分支实际上是在 svn 存储库上创建的。 This worked great.这很好用。

When I was done with my branch, I did a checkout on master and did a git merge.完成分支后,我在 master 上进行了结帐并进行了 git 合并。 This worked fine.这工作得很好。 I then went to commit the merge back to the trunk on the svn repos so issues a git svn dcommit.然后我将合并提交回 svn 存储库上的主干,因此发出 git svn dcommit。

And it tried to commit to the branch.它试图提交给分支。 Even though I now have the master branch checked out.即使我现在已经检查了主分支。 What am I missing?我错过了什么?

$ 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??

This is my.git/config in case it matters这是 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

I thought someone asked this already, but I can't find it again.我以为有人已经问过这个了,但我再也找不到了。 Anyway, git-svn with branches is complicated.无论如何,带有分支的 git-svn 很复杂。 You must create empty branches on the svn side, with git svn branch or plain svn mkdir .您必须在 svn 端创建空分支,使用git svn branch或普通svn mkdir Then you check out those branches with git, and rebase commits on top of them without using git-level merges.然后,您使用 git 检查这些分支,并在不使用 git 级合并的情况下在它们之上重新提交提交。 This way the git branches have the right svn branch indicated in their ancestry, and dcommit commits to the correct branch.这样,git 分支在其祖先中指示了正确的 svn 分支,并且 dcommit 提交到正确的分支。 You can verify the branch git-svn would commit to using git svn info .您可以验证分支 git-svn 是否承诺使用git svn info

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

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