Joseph
Joseph

Reputation: 803

Why does git detect conflicts in identical lines? Line endings are also identical

This question has apparently been asked often, but the culprit seems to be line endings and whitespace in most cases.

However, I have a case where the line endings are also verifiably identical and there is no other whitespace in the conflicted portion. For example:

<<<<<<< HEAD
}
=======
}
>>>>>>> develop

And a text editor screenshot with line endings displayed:

Identical code conflict with line endings displayed

both show , which indicates a \n character - it would display for \r, and for \r\n.

There is literally no other character besides the identical }\n on both sides. Why is this detected as a conflict and how do I avoid it?

Upvotes: 2

Views: 143

Answers (1)

eftshift0
eftshift0

Reputation: 30174

If you are working around the EOF, then probably a file has an EOL then EOF:

}<EOL>
<EOF>

In the other you do not have the EOL, just the EOF:

}<EOF>

Or one of them could be:

}<EOL>
<EOL>
<EOF>

That's enough for git to show a conflict:

  • EOL = end of line
  • EOF = end of file

Upvotes: 6

Related Questions