Skip to main content
Version: 11.x

使用 Git

锁文件

🌐 Lockfiles

你应该始终提交锁定文件(pnpm-lock.yaml)。这样做有多种原因,其中主要原因是:

🌐 You should always commit the lockfile (pnpm-lock.yaml). This is for a multitude of reasons, the primary of which being:

  • it enables faster installation for CI and production environments, due tobeing able to skip package resolution

  • it enforces consistent installations and resolution between development,testing, and production environments, meaning the packages used in testingand production will be exactly the same as when you developed your project

合并冲突

🌐 Merge conflicts

pnpm 可以自动解决 pnpm-lock.yaml 中的合并冲突。 如果你有冲突,只需运行 pnpm install 并提交更改。

🌐 pnpm can automatically resolve merge conflicts in pnpm-lock.yaml. If you have conflicts, just run pnpm install and commit the changes.

不过请注意。建议你在暂存提交之前先审查更改,因为我们不能保证 pnpm 会选择正确的分支 —— 它会使用最新的锁文件进行构建,在大多数情况下这是理想的。

🌐 Be warned, however. It is advised that you review the changes prior to staging a commit, because we cannot guarantee that pnpm will choose the correct head - it instead builds with the most updated of lockfiles, which is ideal in most cases.