Git 合并冲突,但没有明显区别

Git merge conflict, but there is no visible difference

我在合并如下所示的分支时经常遇到冲突:

<<<<<<< HEAD
    private readonly IAdminService _adminService;

=======
    private readonly IAdminService _adminService;

>>>>>>> refs/remotes/origin/master

没有明显的区别。什么会导致 github 将此视为冲突?

通常这是由白色 space 字符调用的,例如制表符,space。你可以设置你的编辑器来显示这些 characters.Also git diff 提供忽略这些字符的选项。

--ignore-space-at-eol

Ignore changes in whitespace at EOL.

-b

--ignore-space-change

Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent.

-w

--ignore-all-space

Ignore whitespace when comparing lines. This ignores differences even > if one line has whitespace where the other line has none.