我正在使用 git-svn
与 SVN 存储库一起工作。我的工作副本是使用 git svn clone -s http://foo.bar/myproject
创建的,以便我的工作副本遵循 SVN 的默认目录结构 (trunk、tags、branches)。
最近我正在一个分支上工作,该分支是使用 git-svn branch myremotebranch
创建的,并使用 git checkout --track -b mybranch myremotebranch
进行了检出。由于需要从多个位置工作,因此我在分支上经常使用 git-svn dcommit
将文件提交到 SVN 存储库。
完成更改后,我切换回主分支并执行了合并,提交了合并,并尝试将成功合并的内容提交到远程主干。
似乎在合并后,主分支的远程跟踪已经切换到我正在工作的分支上:
# git checkout master
# git merge mybranch
... (successful)
# git add .
# git commit -m '...'
# git svn dcommit
Committing to http://foo.bar/myproject/branches/myremotebranch ...
#
有没有一种方法可以使主分支更新后像合并前一样跟踪 remotes/trunk
?
我正在使用 git 1.7.0.5,如果这有帮助的话。
如果您能解释一下为什么会发生这种情况,那就太好了,这样我就可以避免再次出现这个问题。谢谢!
编辑:
这是我的当前 .git/config
文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
autocrlf = false
[svn-remote "svn"]
url = http://foo.bar/myproject
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*
[branch "mybranch"]
remote = .
merge = refs/remotes/myremotebranch
看起来主干指向了正确的位置。然而,切换到分支后再回到主干没有帮助; 在主干上使用 git svn dcommit
仍然试图推送到 myremotebranch
。