2

I recently discovered that rails or some other entity is messing up my code by putting "<<<<<<< HEAD" all over the place. This is an example of what it looks like:

Class ExampleController
  def foo
    bar = 1
<<<<<<< HEAD
    if bar == 1
      puts "bar is one"   
    else
      puts "bar is not one"
    end
=======
  if bar == 2
    puts "bar is two"
  else
    puts "bar is not two"
  end
>>>>>>> 17fb60436a4de2e0...
  end
end

Anyone know why its behaving like this?

Anthony Alberto
  • 10,325
  • 3
  • 34
  • 38
Huub Mons
  • 149
  • 1
  • 11

1 Answers1

10

Yep, you or someone else is using GIT to version-control these sources, which is good.

Now you have to know how to resolve conflicts!

How to resolve merge conflicts in Git?

If you are the one using git, please be careful when pulling code. If there's CONFLICT written somewhere, STOP! Then use git mergetool or go through the list of each file concerned by a CONFLICT and edit them by hand.

Conflicting code is marked with <<<<<<, ======== and >>>>>>>. You have to merge it

Community
  • 1
  • 1
Anthony Alberto
  • 10,325
  • 3
  • 34
  • 38
  • I think you mean *someone* is managing those files in git, and then not using a difftool when there's a conflict. And if the OP doesn't recognize the <<<<<<< marker, it's probably not Huub Mons messing up the merge. – ruffin Aug 02 '12 at 19:51
  • 1
    Well, the worst would have been that indeed someone took unmerged code from git and just copy/pasted it and gave it to the OP. Without the .git folder. Nightmare :p – Anthony Alberto Aug 02 '12 at 19:53
  • So git is the culprit eh? I will take a look at fixing those merge conflicts. Thanks! – Huub Mons Aug 02 '12 at 19:59
  • Culprit? git doesn't confuse people. people using git confuse people. ;^) Good luck unconfusing whoever used git. – ruffin Aug 03 '12 at 14:20