1

I'm trying to merge two of my branches and while trying to resolve the conflicts I can usually just open up the file and github has added

">>>>HEAD
 {my code}
 ========
 {other code}
 >>>>Other"

this shows me which specific lines of code are different in the two versions and then I can decide which lines to keep. However, when I'm merging some of the PHP files don't show the exact differences. Instead the PHP file has my version on top with all the lines included and the other version on bottom. It's a lot harder trying to resolve conflicts this way. Are there any suggestions as to why this is happening? How can I resolve my conflicts in an easier way?

respectus
  • 15
  • 4
  • Most likely the line endings in the file have changed, so it looks like every single line of the file has been altered. Google for "git auto.crlf" for ways to deal with this problem. (Hint: in general, setting auto.crlf to true is a good idea) – Chris B Jun 12 '12 at 01:14

2 Answers2

0

I tend just to fix the merges manually by editing the files. Hopefully you don't have to do that too often. However, there is a mergetool that I've seen people use.

http://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html

Hoe that helps

Frank Sposaro
  • 8,511
  • 4
  • 43
  • 64
0

That is a side-effect mentioned by Rich in his answer.

One little hiccup that I've noticed with this setup is that when there are merge conflicts, the lines git adds to mark up the differences do not have Windows line-endings, even when the rest of the file does, and you can end up with a file with mixed line endings

That is one more argument to avoid core.autocrlf true, and set it to false.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250