git-svn:重置master的跟踪 [英] git-svn: reset tracking for master
问题描述
我使用 git-svn
来使用SVN存储库。我的工作副本是使用 git svn clone -s http://foo.bar/myproject
创建的,以便我的工作副本遵循SVN的默认目录方案(trunk,tags ,
最近我一直在使用 git-svn branch myremotebranch
创建一个分支,并使用 git checkout --track -b mybranch myremotebranch
签出。我需要从多个地方工作,所以从分支我 git-svn dcommit
-ed文件定期到SVN存储库。
完成我的更改后,我切换回主服务器并执行合并,提交合并,并尝试将成功合并到远程主干。
似乎在合并之后,主人的远程跟踪已切换到我正在处理的分支:
# git checkout master
#git merge mybranch
...(成功)
#git add。
#git commit -m'...'
#git svn dcommit
致力于http://foo.bar/myproject/branches/myremotebranch ...
#
有没有一种方法可以更新主设备,使其跟随 remotes / trunk
与合并之前一样
我使用git 1.7.0.5,如果有帮助的话。 p>
如果您还可以解释发生这种情况的原因,这将非常有用,因此我可以避免再次发生问题。
$ b
编辑:
这是我目前的 .git / config
:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
autocrlf = false
[svn-remotesvn]
url = http://foo.bar / myproject
fetch = trunk:refs / remotes / trunk
ranches = branches / *:refs / remotes / *
tags = tags / *:refs / remotes / tags / *
[分支mybranch]
remote =。
merge = refs / remotes / myremotebranch
所以看起来干线指向正确的地方。但是,切换到分支然后回到主人不会帮助; git svn dcommit
仍会尝试推送至 myremotebranch
。
工作在合并时,使用 git merge --no-ff
。这将强制git创建合并提交,然后可以将其提交给svn。
I'm using git-svn
to work with an SVN repository. My working copies have been created using git svn clone -s http://foo.bar/myproject
so that my working copy follows the default directory scheme for SVN (trunk, tags, branches).
Recently I've been working on a branch which was created using git-svn branch myremotebranch
and checked-out using git checkout --track -b mybranch myremotebranch
. I needed to work from multiple locations, so from the branch I git-svn dcommit
-ed files to the SVN repository quite regularly.
After finishing my changes, I switched back to the master and executed a merge, committed the merge, and tried to dcommit the successful merge to the remote trunk.
It seems as though after the merge the remote tracking for the master has switched to the branch I was working on:
# git checkout master
# git merge mybranch
... (successful)
# git add .
# git commit -m '...'
# git svn dcommit
Committing to http://foo.bar/myproject/branches/myremotebranch ...
#
Is there a way I can update the master so that it's following remotes/trunk
as before the merge?
I'm using git 1.7.0.5, if that's any help.
It would be useful if you could also explain why this happened, so I can avoid the problem happening again. Thanks!
Edit:
Here is my current .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
So it seems that the trunk is pointing to the correct place. However, switching to the branch then back to the master doesn't help; git svn dcommit
in the master still tries to push to myremotebranch
.
When there are no changes on trunk, git does a fast-forward merge and simply sets the local "master" branch to the commit on your branch. Git-svn doesn't know how to commit fast-forward merges back to trunk, in fact it thinks "master" now is pointing to the svn branch.
To work around this, use git merge --no-ff
when merging. This will force git to create a merge commit, which can then be dcommitted to svn.
这篇关于git-svn:重置master的跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!