使用 Git

锁文件#

你应该始终提交锁文件(pnpm 生成的 pnpm-lock.yaml 文件)。这是出于多种原因,主要是:

  • 在 CI 和生产环境中能够更快地完成安装,因为解析依赖的过程可以被跳过。
  • 开发,测试和生产环境之间强制执行一致的安装和解析方案,这意味着测试和生产中使用的包将与你开发项目时完全相同

合并冲突#

pnpm 可以自动解决 pnpm-lock.yaml 的合并冲突。 If you have conflicts, run pnpm install and commit the changes.

If both sides of the conflict are valid lockfiles, pnpm merges them. Otherwise it fails with the parse error. Review the result before committing.

To avoid lockfile merge conflicts, use Git branch lockfiles.