0

I have a merge conflict and know the conflict but confuse as to how to fix it.

<<<<<<< HEAD
   orm_adapter (0.5.0)
=======
   arser (2.3.1.4)
     ast (~> 2.2)
>>>>>>> master

<<<<<<< HEAD
warden (1.2.6)
  rack (>= 1.0) 
=======
unicode-display_width (1.1.1)
>>>>>>> master

Do I just add the conflict gem into gem file?

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
codda
  • 1
  • 6
  • @AndreyDeineko that is a terrible suggestion unless this is a brand new project or OP was very careful about specifying gem versions in the Gemfile. – Logan Serman Oct 22 '16 at 19:11
  • As a good practice it's not recommended to add Gemfile.lock to git because anyways it will be created everytime when bundle install is run – uday Oct 22 '16 at 23:45
  • @uDaY that is definitely not best practice. That would lead to each developer having a different set of gem versions installed on their development machine. Additionally, it would lead to your servers having different gem versions installed than what you are developing against. – Paul Hoffer Oct 23 '16 at 17:18

1 Answers1

1

You do not want to delete your Gemfile.lock. What you should do is reset the lock file and then bundle again.

git checkout Gemfile.lock
bundle

If you delete the lock file and bundle, you are most likely going to upgrade a lot of gems in your app. Even if you have done a good job of pessimistic versioning, you'll still upgrade patch versions, which is something you don't want to do just because of a merge conflict.

Also, regarding the thought of not adding the lock file to git, do not do that. Doing so would lead to each developer having a different set of gem versions installed on their development machine. Additionally, it would lead to your servers having different gem versions installed than what you are developing against.

All this is doing is resetting the lock file to its state before any changes were made to the Gemfile. Running bundle will add (to the lock file) whatever gem was added to the Gemfile. However, it will not change any other gems in the lock file. If you delete the lock file, it will generate a completely new lock file based off the Gemfile, which will have the most current gem versions allowed (current unless there was any versioning in the Gemfile).

Paul Hoffer
  • 12,606
  • 6
  • 28
  • 37