Skip to content

Commit c92280f

Browse files
bearomorphismLee-W
authored andcommitted
docs(bump): add missing --allow-no-commit behaviors and other minor documentation changes
1 parent 89564c6 commit c92280f

File tree

1 file changed

+46
-32
lines changed

1 file changed

+46
-32
lines changed

docs/commands/bump.md

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Commitizen supports the [PEP 440][pep440] version format, which includes several
111111

112112
### `--files-only`
113113

114-
Bumps the version in the files defined in [`version_files`](#version_files) without creating a commit and tag on the git repository,
114+
Bumps the version in the files defined in [`version_files`](#version_files) without creating a commit and tag on the git repository.
115115

116116
```bash
117117
cz bump --files-only
@@ -128,7 +128,7 @@ cz bump --changelog
128128
### `--prerelease`
129129

130130
The bump is a pre-release bump, meaning that in addition to a possible version bump the new version receives a
131-
pre-release segment compatible with the bumps version scheme, where the segment consist of a _phase_ and a
131+
pre-release segment compatible with the bump's version scheme, where the segment consists of a _phase_ and a
132132
non-negative number. Supported options for `--prerelease` are the following phase names `alpha`, `beta`, or
133133
`rc` (release candidate). For more details, refer to the
134134
[Python Packaging User Guide](https://packaging.python.org/en/latest/specifications/version-specifiers/#pre-releases).
@@ -281,19 +281,20 @@ Any other messages generated by `cz bump` will be sent to `stderr`.
281281
When this flag is used, `--changelog` is implied.
282282
However, it is recommended to set `--changelog` (or the setting `update_changelog_on_bump`) explicitly when the option `--changelog-to-stdout` is used.
283283

284-
#### Useful scenarios
284+
!!! note "Useful scenarios"
285+
Pipe the newly created changelog to another tool.
285286

286-
This is useful to pipe the newly created changelog to another tool. For example, it can be sent to an auditing system, or to create a GitHub Release, etc.
287+
The output can be redirected to an auditing system, or used to create a GitHub Release, etc.
287288

288-
```bash
289-
cz bump --changelog --changelog-to-stdout > body.md
290-
```
289+
```bash
290+
cz bump --changelog --changelog-to-stdout > body.md
291+
```
291292

292293
### `--git-output-to-stderr`
293294

294-
If `--git-output-to-stderr` is used, git commands output is redirected to `stderr`.
295+
Redirects git commands output to `stderr`.
295296

296-
Useful when used with `--changelog-to-stdout` and piping the output to a file,
297+
Useful when used with `--changelog-to-stdout` and piping the output to a file.
297298

298299
For example, `git commit` output may pollute `stdout`, so it is recommended to use this flag when piping the output to a file.
299300

@@ -306,7 +307,7 @@ Useful to combine with code formatters, like [Prettier](https://prettier.io/).
306307

307308
### `--major-version-zero`
308309

309-
Breaking changes does not bump the major version number.
310+
Breaking changes do not bump the major version number.
310311

311312
Say you have a project with the version `0.1.x` and you commit a breaking change like this:
312313

@@ -344,7 +345,7 @@ Then the version of your project will be bumped to `0.2.0` instead of `1.0.0`.
344345

345346
### `--gpg-sign`
346347

347-
Create gpg signed tags.
348+
Creates gpg signed tags.
348349

349350
```bash
350351
cz bump --gpg-sign
@@ -367,18 +368,16 @@ See [the template customization section](../customization.md#customizing-the-cha
367368

368369
### `--build-metadata`
369370

370-
Provides a way to specify additional metadata in the version string. This parameter is not compatible with `--local-version` as it uses the same part of the version string.
371+
Specifies additional metadata in the version string.
371372

372373
```bash
374+
# creates a version like `1.1.2+yourmetadata`.
373375
cz bump --build-metadata yourmetadata
374376
```
375377

376-
Will create a version like `1.1.2+yourmetadata`.
377-
378-
This can be useful for multiple things
379-
380-
- Git hash in version
381-
- Labeling the version with additional metadata.
378+
!!! note "Example usage"
379+
- Git hash in version
380+
- Labeling the version with additional metadata.
382381

383382
!!! note
384383
Commitizen ignores everything after `+` when it bumps the version.
@@ -392,16 +391,19 @@ This can be useful for multiple things
392391
- Version `1.2.3+a`, and `1.2.3+b` are the same version! Tools should not use the string after `+` for version calculation. This is probably not a guarantee (example in helm) even tho it is in the spec.
393392
- It might be problematic having the metadata in place when doing upgrades depending on what tool you use.
394393

394+
!!! warning
395+
This parameter is not compatible with `--local-version` as it uses the same part of the version string.
396+
395397
### `--get-next`
396398

397-
Provides a way to determine the next version and write it to stdout. This parameter is not compatible with `--changelog`
398-
and `manual version`.
399+
Similar to `--dry-run` but only outputs the next version.
399400

400401
```bash
402+
# outputs 1.0.1 if the current version is 1.0.0 and the increment is PATCH
401403
cz bump --get-next
402404
```
403405

404-
Will only output the next version, e.g., `1.2.3`. This can be useful for determining the next version based on CI for non-production environments/builds.
406+
Useful for determining the next version based on CI for non-production environments/builds.
405407

406408
!!! note "Compare with `--dry-run`"
407409
`--dry-run` provides a more detailed output including the changes as they would appear in the changelog file, while `--get-next` only outputs the next version.
@@ -427,15 +429,27 @@ Will only output the next version, e.g., `1.2.3`. This can be useful for determi
427429

428430
### `--allow-no-commit`
429431

430-
Allow the project version to be bumped even when there's no eligible version. This is most useful when used with `--increment {MAJOR,MINOR,PATCH}` or `[MANUAL_VERSION]`
432+
Allow the project version to be bumped even when there's no eligible version.
431433

432-
```sh
433-
# bump a minor version even when there's only bug fixes, documentation changes or even no commits
434-
cz bump --incremental MINOR --allow-no-commit
434+
!!! note "Example usage"
435+
```sh
436+
# bump a minor version even when there's only bug fixes, documentation changes or even no commits
435437

436-
# bump version to 2.0.0 even when there's no breaking changes changes or even no commits
437-
cz bump --allow-no-commit 2.0.0
438-
```
438+
cz bump --increment MINOR --allow-no-commit
439+
440+
# bump version to 2.0.0 even when there's no breaking changes or even no commits
441+
cz bump --allow-no-commit 2.0.0
442+
```
443+
444+
!!! note "Default increment"
445+
The increment is overridden to `PATCH` if there is no increment detected or specified.
446+
447+
In other words, `cz bump --allow-no-commit` allows you to bump the version to the next patch version even when there is no eligible commit.
448+
449+
```sh
450+
# will bump to `1.0.1` if the current version is `1.0.0`.
451+
cz bump --allow-no-commit
452+
```
439453

440454
### `--version-scheme`
441455

@@ -480,19 +494,19 @@ Supported variables:
480494

481495
| Variable | Description |
482496
|--------------------------------|---------------------------------------------|
483-
| `$version`, `${version}` | fully generated version |
497+
| `$version`, `${version}` | fully generated version |
484498
| `$major`, `${major}` | MAJOR increment |
485499
| `$minor`, `${minor}` | MINOR increment |
486500
| `$patch`, `${patch}` | PATCH increment |
487501
| `$prerelease`, `${prerelease}` | Prerelease (alpha, beta, release candidate) |
488-
| `$devrelease`, ${devrelease}` | Development release |
502+
| `$devrelease`, `${devrelease}` | Development release |
489503

490504
### `version_files`
491505

492506
Identify the files or glob patterns which should be updated with the new version.
493507

494508
Commitizen will update its configuration file automatically when bumping,
495-
regarding if the file is present or not in `version_files`.
509+
regardless of whether the file is present or not in `version_files`.
496510

497511
You may specify the `version_files` in your configuration file.
498512

@@ -686,7 +700,7 @@ See [Version Schemes](#version-schemes-version-scheme).
686700
Some situations from Commitizen raise an exit code different from 0.
687701
If the error code is different from 0, any CI or script running Commitizen might be interrupted.
688702

689-
If you have a special use case, where you don't want to raise one of this error codes, you can
703+
If you have a special use case, where you don't want to raise one of these error codes, you can
690704
tell Commitizen to not raise them.
691705

692706
### Recommended use case

0 commit comments

Comments
 (0)