git-svn:在 svn rebase 后保留单个合并提交
我按照这种模式使用 git-svn 将功能分支中的代码签入到 Subversion:
git checkout master git svn rebase git checkout feature-branch git rebase master git checkout master git merge --no-ff feature-branch git commit --amend git svn dcommit
(master 是我的远程 Subversion 跟踪分支)
这会在 master 上创建单个合并提交(无论我在功能上完成了多少次 git 提交) -branch),我可以将其签入 Subversion。
然而,在我将功能分支合并到 master 后,有人将代码检查到 Subversion,当我执行命令 git svn rebase 时,会应用新的更改,并且功能分支中的每个单独提交都会应用到顶部。此时,我不再有单个合并提交,而是在 master 中的功能分支上执行的每个提交。
处理这个问题的最佳方法是什么?
I am following this pattern to check in my code in feature-branch to Subversion with git-svn:
git checkout master git svn rebase git checkout feature-branch git rebase master git checkout master git merge --no-ff feature-branch git commit --amend git svn dcommit
(master is my remote Subversion tracking branch)
This creates a single merge commit on master (regardless of how many git commits I have done on feature-branch) which I can check into Subversion.
However, someone checks code into Subversion after I merge feature-branch into master, when I execute the command git svn rebase
the new changes are applied and each individual commit from feature-branch is applied on top. At this point I no longer have a single merge commit but every commit that I performed on feature-branch in master.
What is the best way to deal with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我是这样做的:
Here is how I do this:
您可以使用
--squash
选项来执行您想要的操作:这可以避免使 feature-branch 成为新提交的父级。听起来多个父母混淆了 git-svn。
You may be able to do what you want by using the
--squash
option:This avoids making feature-branch a parent of your new commit. It sounds like the multiple parents is confusing git-svn.