0

I'm learning Ruby on Rails and was following the tutorial minding my own business, but after creating and trying to merge static pages etc., my app is failing to deploy on heroku and the tests are failing all of a sudden.

Based on the research I've done this is may be due to a merge conflict? In any case, the following lines:

<<<<<<< HEAD
content
>>>>>>> efcece9f3324a1a06d5f70e2a350b33d0c06d6c7

Have popped up in a bunch of my files (gemfile, gemfile.lock and even a controller) pretty randomly randomly. My tests no longer return green but now display an error "unexpected <<". I'm a noob and totally confused?

Can anyone help me understand if this is indeed a merging conflict, and in any case what caused this and how do I go about fixing it?

O.Don
  • 51
  • 6

1 Answers1

0

Indeed, this smells like merge conflicts.

First, make a zipped copy of your folder (in case my instructions mess you up further, you can go back to it)

Second, find out which files have the conflicts.

git grep '<<<<<<<' 

I'm hoping it's a bit less than 16 files. I would open up each of the files, have a look at the stuff around the <<< and >>> Ask yourself, how SHOULD this file look like in a perfect world? Edit the files to make them look the way it should.

Then do

git add .
git commit -m "Fixing conflicts"
git push heroku master
american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80
  • This was exactly the problem. I did as you said and unfortunately, it was indeed 16 files but after adjusting them all everything flowed smoothly. Thanks much! Are you able to tell me why this happened in the first place and how I may go about preventing it from happening in the future? – O.Don Jan 09 '18 at 01:00
  • @O.Don when you merge 2 branches git tries to merge them itself but if the same file has been modified on both branches then git is unable to work out how you want this file to look so you have to go and manually tell it which bits to include in the the merged version. There are git GUI tools that make this easier. – Qwertie Jan 09 '18 at 04:20
  • I'd suggest using some software like kdiff3 to solve merge conflicts. Manually fixing files and looking for <<<< is not the right solution – Justas G Sep 17 '18 at 16:09