Debian Codegraph @

docs/commands/version.md

raw
1 Get the version of the installed Commitizen or the current project (default: installed commitizen).
2
3 ## Usage
4
5 ![cz version --help](../images/cli_help/cz_version___help.svg)
6
7 ## Project version and scheme
8
9 - **`cz version --project`** prints the version from your configured [version provider](../config/version_provider.md).
10 - **`cz version MANUAL_VERSION`** (optional positional) uses that string instead of the provider, so you can try how your configured scheme parses and formats it.
11
12 ## Components and next version
13
14 - **`--major`**, **`--minor`**, **`--patch`**: print only that component of the (possibly manual) project version. Requires `--project`, `--verbose`, or a manual version.
15 - **`--next` `[MAJOR|MINOR|PATCH|NONE]`**: print the version after applying that bump to the current project or manual version. `NONE` leaves the version unchanged.
16 - **`--next USE_GIT_COMMITS`**: derive the bump automatically from the commits since the tag matching the current version, using your commit rules' bump map (the same logic as `cz bump`). Passing `--next` with no value defaults to `USE_GIT_COMMITS`. If no tag matches the current version, all commits are considered. When there are no new commits (and the current version is not a pre-release), the command errors out. The functionality does not yet include advanced versioning like prereleases or exact_increment.
17 - **`--tag`**: print the version formatted with your `tag_format` (requires `--project` or `--verbose`).
18
19 ## Examples
20
21 ```bash
22 cz version --project
23 cz version 2.0.0 --next MAJOR
24 cz version --project --major
25 cz version --verbose
26
27 # Derive the next version from the commits since the current version's tag
28 cz version --project --next USE_GIT_COMMITS
29 # Equivalent shorthand (--next defaults to USE_GIT_COMMITS)
30 cz version --project --next
31 # Retrieve just the next major part of the version
32 cz version --project --next --major
33 # Works with a manual version too
34 cz version 1.4.0 --next
35 # Combine with --tag to format the derived version using your tag_format
36 cz version --project --next --tag
37 ```