将 git dcommits 切换到 svn 分支
我有 master
dcommit
到 Subversion trunk
(以及 rebase
)。
我创建了一个中间 Subversion 分支 tc
,以合并来自 2 个不同分支的更改,使用:
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
由于一切都很好,我想将其提升到 trunk
。我接着做:
git branch master
git merge tcl
git svn dcommit
现在,因为 master
是从另一个指向不同 Subversion 分支的分支合并的,所以它尝试提交到 Subversion 分支 tc
。我希望它提交到 Subversion trunk
。
是否有 git svn switch 或类似的东西?
我知道我的工作流程不是最佳的,也欢迎任何改进它的建议。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如这个问题,在带有
git-svn
的存储库中使用git merge
并不是一个好主意。相反,您应该做的是将更改“合并”到
master
中:在这种情况下
git merge
的问题是它还设置了git- svn
master
到 SVNtc
分支的 URL。format-patch
和am
组合仅接受更改本身。As mentioned in this question, using
git merge
in a repository withgit-svn
is not a good idea.Instead, what you should have done to "merge" the changes into
master
is:The problem with
git merge
in this case is that it also sets thegit-svn
URL formaster
to the SVNtc
branch. Theformat-patch
andam
combination only takes the changes themselves.AFAIK
--no-ff
合并会按照您想要的方式进行:AFAIK a
--no-ff
merge would have gone the way you want: