Skip to content

Gemfile.lock is recommended to be in source control #278

@pboling

Description

@pboling

Prior to 2017 it was common, and considered best practice, to exclude Gemfile.lock from version control, but then things changed, and the Bundler team decided, after much discussion, that it is best to commit it for both libraries and apps.

In the official bundler guide to creating a RubyGem, it is in bold, and italic font, that the file is extremely important, and it states that it should always be in version control.

But the previous common practice was very widely known for many years, so it is taking a long time to overturn.

Image

Keeping it in version control does make CI more complex, because many different Rubies cannot share the same Gemfile due to Ruby version contraints of the dependencies resulting in differing installed versions of gems.

With ruby gems (not apps) I use the rubric:

Gemfile is for local development only; never CI

Accounting for this has a side benefit of bringing additional structure and stability to CI. Failures due to changes in dependency resolution become effortlessly apparent.

I would recommend appraisal2 to handle multiple gemfiles, but I am also quite handy at implementing a similar solution without appraisal2 (in fact that is precisely what I did for appraisal2's test suite).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions