Gemfile and Gemfile.lock
Gemfile
Simply put, Gemfile is a format for describing gem dependencies for Ruby programs. Or you can say it contains the gems you need in this project.
Gemfile.lock
Gemfile.lock is a file records exact versions of all the gems you used the last time you know for sure that the application worked.
If there is error during the first time you install the gem, noGemfile.lock
file will be created. After you create yourGemfile.lock
, every time you update, add or remove some gems install that, the Gemfile.lock will modify the version of the gem.
Again, if there is any error occurs while installing, theGemfile.lock
will not be updated and remained as the last state.
The reason Gemfile.lock
is important is when other developers fork your project, theGemfile.lock
can make sure after they run bundle install, the app can run on their computers. Instead of installing the latest version of each gem then breaks the app.
Resource: What is Gemfile
Resource: Gemfile