S
S
sorry_i_noob2019-02-14 15:22:57
git
sorry_i_noob, 2019-02-14 15:22:57

Why does Git consider two exactly the same code to be a conflict?

Hello. Made a pull, there was a conflict. I started trying to resolve it. I started looking at the difference. There is no difference, but Git highlights the same code in red. Why? I am attaching a screenshot.5c655d8b873f4375418493.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir, 2019-02-14
@sorry_i_noob

1) To see the conflict, you need to show a three-way merge and not two, then it will be clear that you may have made the same changes to both commits.
As an option, you go to the first commit, look at what you changed in this file, and go to the second one.
5c65623b65cab116777175.png

S
shai_hulud, 2019-02-14
@shai_hulud

Possibly different line-endings on these lines (/r/n and /n)

J
justPK, 2019-02-15
@justPK

This is because git does not compare files, but commits.
If 2 commits make changes to lines 4292 to 4322 (and if there are any further), git considers these to be conflicting changes and what should end up in the file is up to the developer.
Otherwise, the git developers will have too many "what if" questions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question