git:有合并时使用 git-svn
据我了解,git-svn 不支持推送合并提交。
有没有办法让它与这样的提交一起工作?
我们尝试使用 rebase 来创建线性历史。但是,这会因空格错误冲突而失败。有没有一种方法可以使历史线性化,从而避免冲突?
As far as I understand, git-svn does not support pushing merge commits.
Is there a way to make it work with such commits?
We have tried to use rebase to create a linear history. However, this fails with conflicts on whitespace errors. Is there a way of linearizing the history so there are no conflicts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将合并提交重新定基到 svn 的最简单方法是压缩它们:
假设我们将分支
dev
重新定基为trunk
,您可能必须修复
trunk
之间的真正合并冲突代码>和<代码>开发。最后你有一个提交,你可以很好地git svn dcommit
。此方法的缺点是您会失去 SVN 中提交的粒度。如果这是一个问题,您可以对 git 采用 rebase 风格的合并策略(例如 http://unethicalblogger.com/2010/04/02/a-rebase-based-workflow.html)。
The simplest way of rebasing merged commits to svn is to squash them:
assuming we rebase branch
dev
totrunk
you might have to fix real merge conflicts between
trunk
anddev
. At the end you have one commit which you can wellgit svn dcommit
.The downside of this method is that you loose granularity of your commits in SVN. If this is a problem, you could employ a rebase-style merging strategy for git (e.g. http://unethicalblogger.com/2010/04/02/a-rebase-based-workflow.html ).
这并不简单,但却是可能的。
检查您的功能分支
创建一个 Subversion 分支,最好使用相同的名称并重新设置本地 git 分支的基础
当您推送更改时,它们将转到 Subversion 分支,而不是主干。
据我所知,进行 e 合并的唯一方法是使用临时 SVN 签出并使用 svn merge。对于可以自动执行且没有冲突的合并,编写最后步骤(SVN 存储库查找、临时签出、合并)的脚本对我来说效果很好。
It's not straightforward, but possible.
Check out your feature branch
Create a Subversion branch, preferrably with the same name and rebase your local git branch
When you push your changes, they will go to the Subversion branch, not to the trunk.
The only way to do e merge that I am aware of is using a temporary SVN checkout and using
svn merge
. For merges that can be performed automatically, without conflicts, scripting the last steps (SVN repository lookup, temporary checkout, merge) has worked well for me.