我对 bundler 及其生成的文件有点陌生。我有一份来自 GitHub 的 git repo 的副本,很多人都在贡献它,所以我很惊讶地发现 bundler 创建了一个在 repo 中不存在且不在 .gitignore中的文件
列表。
因为我已经 fork 了它,我知道将它添加到 repo 不会破坏主 repo 的任何东西,但是如果我做一个 pull request,它会导致问题吗?
Gemfile.lock
应该包含在存储库中吗?
最佳答案
2022 年更新 来自 TrinitronX
Fast-forward to 2021 and now Bundler docs [web archive] now say to commit the Gemfile.lock inside a gem... ¯_(ツ)_/¯ I guess it makes sense for developers and ease of use when starting on a project. However, now CI jobs need to be sure to remove any stray Gemfile.lock files to test against other versions.
遗留答案 ~2010
假设您不是在编写 rubygem,Gemfile.lock 应该在您的存储库中。它用作所有必需的 gem 及其依赖项的快照。这样,打包程序就不必在每次部署时重新计算所有的 gem 依赖项等。
下面是 cowboycoded 的评论:
If you are working on a gem, then DO NOT check in your Gemfile.lock. If you are working on a Rails app, then DO check in your Gemfile.lock.
这是一个不错的 article解释什么是锁定文件。
关于ruby - Gemfile.lock 应该包含在 .gitignore 中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4151495/