Switch the svn branch git dcommits to

陌路散爱 提交于 2019-12-07 02:54:12

问题


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.


回答1:


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.




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!