git中“Resolve using theirs”的默认行为是什么

时间:2016-12-29 15:20:35

标签: git merge git-merge atlassian-sourcetree merge-conflict-resolution

根据this question,我知道可以保留所有未引起任何冲突的更改,同时对冲突的更改使用their更改。

我想知道的是,当使用SourceTree(或相关的任何git工具甚至命令行)时,在单个文件上选择Resolve using theirs时的默认行为(甚至是完全合并)。

  • 是否只是用遥控器中的任何内容替换完整的本地文件?
  • 是否保留所有本地非冲突的更改,并且只对所有冲突使用theirs

2 个答案:

答案 0 :(得分:4)

它解决了非冲突的更改,并且更喜欢theirs用于冲突的更改。 (与ours相反)

来自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.

答案 1 :(得分:0)

不幸的是,如果文件发生冲突,而您选择“使用其解析”,则Git会将完整的本地文件替换为它们的文件,而不仅仅是冲突行。