I had master dcommit to (and rebase from) the Subversion trunk.
I created an intermediate Subversion branch tc, to merge changes from 2 different branches, using:
git branch master
git svn branch tc -m "Branch for merging"
git checkout -b tcl --track tc
git merge cat #Another branch, whose changes I merged here
git commit -m 'Merged changes from cat branch'
git svn dcommit
Since everything was fine, I wanted to promote this to the trunk. I followed doing:
git branch master
git merge tcl
git svn dcommit
Now, because master was merged from another branch that was pointing to a different Subversion branch, it tries to commit to the Subversion branch tc. I want it committed to the Subversion trunk.
Is there a git svn switch or something like that?
I know my workflow is not the optimal and any suggestions to improve it are welcome too.
As mentioned in this question, using git merge in a repository with git-svn is not a good idea.
Instead, what you should have done to "merge" the changes into master is:
git checkout master
git format-patch --stdout master..tcl | git am
git svn dcommit
The problem with git merge in this case is that it also sets the git-svn URL for master to the SVN tc branch. The format-patch and am combination only takes the changes themselves.
AFAIK a --no-ff merge would have gone the way you want:
git branch master
git merge --no-ff tcl
git svn dcommit
来源:https://stackoverflow.com/questions/6730068/switch-the-svn-branch-git-dcommits-to