docs/git_branch_lockfiles.md
Git branch lockfiles allows you to totally avoid lockfile merge conflicts and solve it later.
You can turn on this feature by configuring the pnpm-workspace.yaml file.
gitBranchLockfile: true
By doing this, lockfile name will be generated based on the current branch name.
For instance, the current branch name is feature-1. Then, the generated lockfile name will
be pnpm-lock.feature-1.yaml. You can commit it to the Git, and merge all git branch lockfiles later.
- <project_folder>
|- pnpm-lock.yaml
|- pnpm-lock.feature-1.yaml
|- pnpm-lock.<branch_name>.yaml
:::note
feature/1 is special in that the / is automatically converted to !, so the corresponding
lockfile name would be pnpm-lock.feature!1.yaml.
:::
pnpm install --merge-git-branch-lockfilesTo merge all git branch lockfiles, just specify --merge-git-branch-lockfiles to pnpm install command.
After that, all git branch lockfiles will be merged into one pnpm-lock.yaml
pnpm allows you to specify --merge-git-branch-lockfiles by matching the current branch name.
For instance, by the following setting in pnpm-workspace.yaml file, pnpm install will merge all git branch lockfiles when
running in the main branch and the branch name starts with release.
mergeGitBranchLockfilesBranchPattern:
- main
- release*