0

My coworker modified a lot of files which I haven't touched at all. But when I try to git pull now, a lot of conflicts appear in the files he touched, but I did not. And the conflict is on the content of the whole file. It starts with:

<<<<<<HEAD
{content of the whole file}
=========
{content of the whole file}
>>>>>>>{commit code}

I want to accept his changes, but proceed with normal conflicts if we really both modified the files. Why does this happen and how to fix it ?

Angel Miladinov
  • 1,596
  • 4
  • 20
  • 43

2 Answers2

0

It's possible that you and your co-worker are using different line endings. This can be the case if you're on different platforms (e.g. Windows vs Linux vs MacOS). See the following questions:

Git marks entire file as conflicted when merging master into branch

What's the best CRLF (carriage return, line feed) handling strategy with Git?

Deniz Genç
  • 107
  • 1
  • 8
  • 2
    Or that git is set up to mess up with EOLs. – eftshift0 Mar 10 '20 at 16:50
  • Yes, he is on Windows and I am on Mac. I tried setting the line edngins git the git global config and etc. I've run a renormalize command, commited again, but sadly the result is the same. A conflict on the whole file. Should I do that on his computer too ? – Angel Miladinov Mar 11 '20 at 08:57
0

In order to solve this the easy and safe way, stash your changes, then pull and finaly apply your stash again.
Any appearing problems should now be "real".

git stash
git fetch
git pull
git stash pop
Ofek Hod
  • 3,544
  • 2
  • 15
  • 26