Answer the question
In order to leave comments, you need to log in
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.
Answer the question
In order to leave comments, you need to log in
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.
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 questionAsk a Question
731 491 924 answers to any question