# lpm version (/docs/packages/version)



```bash
lpm version patch
```

Bumps the current package's `package.json` version. By default, LPM writes the manifest, commits it, and creates a git tag just like `npm version`, but with stricter release safety: the git tree must be clean before commit/tag, and exact versions must move forward.

The built-in command wins over a package script named `version`. To run that script, use [`lpm run version`](/docs/dev/run).

## Examples [#examples]

```bash
lpm version patch                         # 1.2.3 -> 1.2.4, commit, tag v1.2.4
lpm version minor --message "release %s"  # commit message: release 1.3.0
lpm version prepatch                      # 1.2.3 -> 1.2.4-0
lpm version prerelease                    # 1.2.4-0 -> 1.2.4-1
lpm version 2.0.0                         # exact forward version
lpm version patch --no-git-tag-version    # edit package.json only
lpm version patch --dry-run --json        # print the plan without writing
```

## Bump values [#bump-values]

| Value        | Effect                                                                                     |
| ------------ | ------------------------------------------------------------------------------------------ |
| `patch`      | Stable patch bump. From a prerelease, releases the same version (`1.2.3-rc.1` -> `1.2.3`). |
| `minor`      | Next minor, patch reset to `0`.                                                            |
| `major`      | Next major, minor and patch reset to `0`.                                                  |
| `prepatch`   | Next patch prerelease (`1.2.3` -> `1.2.4-0`).                                              |
| `preminor`   | Next minor prerelease (`1.2.3` -> `1.3.0-0`).                                              |
| `premajor`   | Next major prerelease (`1.2.3` -> `2.0.0-0`).                                              |
| `prerelease` | Increment the prerelease number, or start the next patch prerelease from a stable version. |
| `<exact>`    | Set an exact semver version, if it is greater than the current version.                    |

## Git behavior [#git-behavior]

With the default git mode, `lpm version`:

1. verifies the current directory is inside a git worktree
2. verifies `git status --porcelain` is clean
3. verifies the target tag name is valid and does not already exist
4. writes `package.json`
5. runs `git add package.json`
6. commits with the message template
7. creates a tag

Use `--no-git-tag-version` when you want only the manifest edit. `--dry-run` prints the same version plan without writing, committing, or tagging.

## Flags [#flags]

| Flag                    | Description                                                                                                         |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `--dry-run`             | Print the plan without writing files, committing, or tagging.                                                       |
| `--json`                | Emit a structured plan with `success`, `dry_run`, `git_tag_version`, `commit`, `tag`, and `plan`.                   |
| `--no-git-tag-version`  | Update `package.json` only.                                                                                         |
| `--tag-prefix <PREFIX>` | Prefix for the git tag. Defaults to `v`; the resulting tag must be accepted by `git tag` and cannot start with `-`. |
| `-m, --message <TEXT>`  | Commit message. `%s` is replaced with the new version. Defaults to `v%s`.                                           |

Plus the [global flags](/docs/commands#global-flags).

## See also [#see-also]

* [`lpm release`](/docs/packages/release) — workspace release planning and publish orchestration
* [`lpm publish`](/docs/packages/publish) — publish the package after a version bump
* [`lpm run`](/docs/dev/run) — run a package script named `version`
