git svn master 到分支到 master - 仍然尝试提交到分支
我按照这篇帖子了解如何创建和签出分支使用 git svn 以便分支实际上是在 svn 存储库上创建的。这效果很好。
当我完成我的分支后,我在 master 上进行了结帐并进行了 git merge。这很好用。然后我将合并提交回 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??
这是我的 .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 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. This worked great.
When I was done with my branch, I did a checkout on master and did a git merge. This worked fine. I then went to commit the merge back to the trunk on the svn repos so issues a 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
[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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以为已经有人问过这个问题了,但我又找不到了。无论如何,带有分支的 git-svn 很复杂。您必须使用 git svnbranch 或普通的 svn mkdir 在 svn 端创建空分支。然后,您使用 git 检查这些分支,并在它们之上重新提交提交,而不使用 git 级别的合并。这样,git 分支就具有在其祖先中指示的正确 svn 分支,并且 dcommit 提交到正确的分支。您可以使用 git svn info 验证 git-svn 提交的分支。
I thought someone asked this already, but I can't find it again. Anyway, git-svn with branches is complicated. You must create empty branches on the svn side, with
git svn branch
or plainsvn mkdir
. Then you check out those branches with git, and rebase commits on top of them without using git-level merges. This way the git branches have the right svn branch indicated in their ancestry, and dcommit commits to the correct branch. You can verify the branch git-svn would commit to usinggit svn info
.