开发者

git svn master to branch to master - still tries to commit to branch

开发者 https://www.devze.com 2023-03-15 19:29 出处:网络
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.

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?开发者_如何学Go?

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


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 plain svn 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 using git svn info.

0

精彩评论

暂无评论...
验证码 换一张
取 消