Git合并忽略空格

11

可能是重复的问题:
git空格问题

如何设置Git,在合并时不仅仅因为空格而报告冲突,就像下面这样?

<<<<<<< HEAD
    open RESDBFILE, "< $this_day_result_file_";
    while ( my $resdbline_ = <RESDBFILE> )
    {
        my @rwords_ = split ' ', $resdbline_;
        if ( exists $uncaliberated_strategies_{$rwords_[0]} )
        { # if this strategy_filename_base was there in @strategy_filevec_
        delete $uncaliberated_strategies_{$rwords_[0]};
        }
    }
    close RESDBFILE;
=======
      open RESDBFILE, "< $this_day_result_file_";
      while ( my $resdbline_ = <RESDBFILE> )
      {
    my @rwords_ = split ' ', $resdbline_;
    if ( exists $uncaliberated_strategies_{$rwords_[0]} )
    { # if this strategy_filename_base was there in @strategy_filevec_
        delete $uncaliberated_strategies_{$rwords_[0]};
    }
      }
      close RESDBFILE;
>>>>>>> origin/stable

1
如果它不报告,它怎么合并呢?随意选择一个来使用吗? - Andy
@Andy 很好的问题!根据ignore-all-space选项的文档:如果他们的版本只是对一行进行了空格更改,则使用我们的版本。如果我们的版本引入了空格更改,但他们的版本包含了实质性的更改,则使用他们的版本。 - TachyonVortex
2个回答

15

尝试:

$ git merge -s ignore-all-space

更多详情请查看:

$ git help merge
/whitespace

22
git merge -Xignore-all-space 对我来说有效,也许是版本问题。 - dsummersl
1
同样适用于git cherry-pick -Xignore-all-space。至少在(几乎)当前版本上是这样。 - Deiwin

2

那不行。core.whitespaces 是关于警告的问题集合,而不是关于合并的。 - Matthieu Moy

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接