如何为git rebase选择合并策略? [英] How do I select a merge strategy for a git rebase?

查看:120
本文介绍了如何为git rebase选择合并策略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git-rebase 手册页提及 -X< option> 可以传递给 GIT中合并。何时/如何到达?



我想通过使用递归策略和他们的选项来应用补丁应用任何支持,而不是跳过整个冲突的提交)。



我试过了:

  git rebase -X他们的

  git rebase -s'recursive -Xtheirs'
在这两种情况下,

但git拒绝 -X




git rebase -Xtheirs 可以在最近的版本中使用,但树冲突需要手动解析。你需要在解决这些冲突后运行 git rebase -X他们 - 继续(带 -X 重复) p>

解决方案

您可以在Git v1.7.3或更高版本中使用此功能。

  git rebase -s递归-X他们$ {branch} 

从Git v1.7.3发行说明:

$ git rebase --strategy 学习了 -X 选项以传递所选合并策略所理解的额外选项。



NB :我们和他们的意味着他们在直接合并期间所做的相反。换句话说,他们赞成当前分支上的提交。 / p>

更新:编辑得更清楚。

git-rebase man page mentions -X<option> can be passed to git-merge. When/how exactly?

I'd like to rebase by applying patches with recursive strategy and theirs option (apply whatever sticks, rather than skipping entire conflicting commits). I don't want merge, I want to make history linear.

I've tried:

git rebase -Xtheirs

and

git rebase -s 'recursive -Xtheirs'

but git rejects -X in both cases.


git rebase -Xtheirs works in recent versions, except tree conflicts need to be resolved manually. You need to run git rebase -Xtheirs --continue (with -X repeated) after resolving those conflicts.

解决方案

You can use this with Git v1.7.3 or later versions.

git rebase -s recursive -X theirs ${branch}

From Git v1.7.3 Release Notes:

git rebase --strategy <s> learned the -X option to pass extra options that are understood by the chosen merge strategy.

NB: "Ours" and "theirs" mean the opposite of what they do during a straight merge. In other words, "theirs" favors the commits on the current branch.

Update: Edited to be clearer.

这篇关于如何为git rebase选择合并策略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆