Gemfile.lock and git repos


#1

Here’s the background:
I develop, sometimes on my macbook, sometimes on a dev machine (Debian stable).

What do I do with the Gemfile.lock ?
Do I check it into git as part of my project?
Or do I exclude it so that each Gemfile.lock is specific to each host?

it seems with Brew vs Debain my environments are different.


#2

Gemfile.lock is meant to provide a consistent environment across platforms. So, it is usually recommended to be checked into version-control so that the exact same gems are used in every environment.
Just run bundle install in the second environment and the exact same gems used on the first environment will be installed and used.
The diff would change considerably only when you run bundle update

Scenario: Gemfile.lock not tracked by Git

You have just Jekyll 3.7.3 on one platform and just Jekyll 3.7.0 on the other.
When you build your Jekyll site, you may encounter bugs fixed between jekyll-3.7.0 and jekyll-3.7.3 only on one environment and you waste time trying to figure out why it happened

Scenario: Gemfile.lock tracked by Git

You have just Jekyll 3.7.3 on one platform and just Jekyll 3.7.0 on the other.
When you build your Jekyll site, Bundler immediately tells you that you do not have jekyll-3.7.3 installed, and to remedy it by running bundle install