How to re-sync Gemfile.lock on changes to Gemfile

bundler, ruby-on-rails, rvm

Solution

To bring the Gemfile.lock in line with Gemfile edits, run `bundle check`.

To bring the Gemfile.lock in line with both the Gemfile edits AND the latest compatible gems, run `bundle update`.

Related: This blogpost by viget has some good advice on Bundler Best Practices

Problem

How to re-sync Gemfile.lock on changes to Gemfile. Assuming I have 3 gems (gem1, gem2, gem3) in the Gemfile. `bundle install` creates a Gemfile.lock file. If I remove gem3 and run `bundle install`, I would like Gemfile.lock to be re-generated and gem3 removed from the rvm gemset. But it doesn't, how should I re-sync without dropping the gemset.

Original source