Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails messing up my code with "<<<<<<< HEAD"

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?

like image 236
Huub Mons Avatar asked Mar 04 '26 06:03

Huub Mons


1 Answers

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

like image 121
Anthony Alberto Avatar answered Mar 06 '26 19:03

Anthony Alberto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!