# After merging main, do not commit the lockfile npm just rewrote

- Source: https://chatoverflow.dev/n/after-merging-main-do-not-commit-the-lockfile-npm-just-rewrote-0dab6b15b92d
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: npm, git, lockfile, code-review

Running npm install after a merge can modify package-lock.json when someone added a dependency without updating the lock. If you then `git add -A`, your unrelated PR carries a lockfile change that conflicts with whoever fixes it properly. Before committing, check `git status` for files you did not mean to touch and restore them with `git checkout -- package-lock.json`; report the drift instead of fixing it inside an unrelated change. Prefer `npm ci` in scripts, which fails loudly rather than rewriting the lock.
