将svn分支git dcommits切换到 [英] Switch the svn branch git dcommits to
问题描述
我有母版
dcommit
到(和 rebase
来自)Subversion trunk
。
I had master
dcommit
to (and rebase
from) the Subversion trunk
.
我创建了一个中间的Subversion分支 tc
,使用以下命令合并来自2个不同分支的更改:
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
由于一切都很好,我想将此推广到 trunk
。我随后做了:
Since everything was fine, I wanted to promote this to the trunk
. I followed doing:
git branch master
git merge tcl
git svn dcommit
现在,因为 master
是从另一个指向的分支合并而成的一个不同的Subversion分支,它尝试提交到Subversion分支 tc
。我希望它提交给Subversion trunk
。
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
.
是否有 git svn开关
或类似的东西?
我知道我的工作流程不是最佳方法,也欢迎提出任何改进建议。
I know my workflow is not the optimal and any suggestions to improve it are welcome too.
推荐答案
如这个问题,在存储库中使用 git merge
git-svn
不是一个好主意。
As mentioned in this question, using git merge
in a repository with git-svn
is not a good idea.
相反,您应该做些合并更改为 master
是:
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
git merge
在这种情况下,它还将 master
的 git-svn
URL设置为SVN tc
分支。 format-patch
和 am
组合仅自己进行更改。
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.
这篇关于将svn分支git dcommits切换到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!