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
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…