解决Git合并冲突有利于他们在拉动过程中的变化 [英] Resolve Git merge conflicts in favor of their changes during a pull
问题描述
如何解决git合并冲突以支持所做的更改?
基本上我需要从工作树中删除所有冲突的更改,而不必经过与的所有冲突git mergetool
,同时保持所有无冲突的更改。您可以使用递归的theirs策略选项。 >:
git merge --strategy-option theirs
来自 man :
我们的
这个选项强制冲突的hunk被
干净地自动解析为我们的版本。来自另一棵不与
冲突的树的变化反映为合并结果。
这不应与我们的合并策略相混淆,即
甚至不会查看其他树包含的内容。它丢弃
其他树的所有内容,声明我们的历史记录包含发生在其中的所有
。
他们
这与我们的相反。
注意:如手册页所示,我们的merge 策略选项与我们的合并策略非常不同。
How do I resolve a git merge conflict in favor of pulled changes?
Basically I need to remove all conflicting changes from a working tree without having to go through all of the conflicts with a git mergetool
while keeping all conflict-free changes. Preferably doing this while pulling, not afterwards.
You can use the recursive "theirs" strategy option:
git merge --strategy-option theirs
From the man:
ours
This option forces conflicting hunks to be auto-resolved cleanly by
favoring our version. Changes from the other tree that do not
conflict with our side are reflected to the merge result.
This should not be confused with the ours merge strategy, which does
not even look at what the other tree contains at all. It discards
everything the other tree did, declaring our history contains all that
happened in it.
theirs
This is opposite of ours.
Note: as the man page says, the "ours" merge strategy option is very different from the "ours" merge strategy.
这篇关于解决Git合并冲突有利于他们在拉动过程中的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!