Skip to content

Commit ff3a457

Browse files
committed
docs(bump): add missing --allow-no-commit behaviors and other minor documentation changes
1 parent cbbf615 commit ff3a457

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).
@@ -280,19 +280,20 @@ Any other messages generated by `cz bump` will be sent to `stderr`.
280280
When this flag is used, `--changelog` is implied.
281281
However, it is recommended to set `--changelog` (or the setting `update_changelog_on_bump`) explicitly when the option `--changelog-to-stdout` is used.
282282

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

285-
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.
286+
The output can be redirected to an auditing system, or used to create a GitHub Release, etc.
286287

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

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

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

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

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

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

306307
### `--major-version-zero`
307308

308-
Breaking changes does not bump the major version number.
309+
Breaking changes do not bump the major version number.
309310

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

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

344345
### `--gpg-sign`
345346

346-
Create gpg signed tags.
347+
Creates gpg signed tags.
347348

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

367368
### `--build-metadata`
368369

369-
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.
370+
Specifies additional metadata in the version string.
370371

371372
```bash
373+
# creates a version like `1.1.2+yourmetadata`.
372374
cz bump --build-metadata yourmetadata
373375
```
374376

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

382381
!!! note
383382
Commitizen ignores everything after `+` when it bumps the version.
@@ -391,16 +390,19 @@ This can be useful for multiple things
391390
- 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.
392391
- It might be problematic having the metadata in place when doing upgrades depending on what tool you use.
393392

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

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

399400
```bash
401+
# outputs 1.0.1 if the current version is 1.0.0 and the increment is PATCH
400402
cz bump --get-next
401403
```
402404

403-
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.
405+
Useful for determining the next version based on CI for non-production environments/builds.
404406

405407
!!! note "Compare with `--dry-run`"
406408
`--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.
@@ -426,15 +428,27 @@ Will only output the next version, e.g., `1.2.3`. This can be useful for determi
426428

427429
### `--allow-no-commit`
428430

429-
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]`
431+
Allow the project version to be bumped even when there's no eligible version.
430432

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

435-
# bump version to 2.0.0 even when there's no breaking changes changes or even no commits
436-
cz bump --allow-no-commit 2.0.0
437-
```
437+
cz bump --increment MINOR --allow-no-commit
438+
439+
# bump version to 2.0.0 even when there's no breaking changes or even no commits
440+
cz bump --allow-no-commit 2.0.0
441+
```
442+
443+
!!! note "Default increment"
444+
The increment is overridden to `PATCH` if there is no increment detected or specified.
445+
446+
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.
447+
448+
```sh
449+
# will bump to `1.0.1` if the current version is `1.0.0`.
450+
cz bump --allow-no-commit
451+
```
438452

439453
### `--version-scheme`
440454

@@ -479,19 +493,19 @@ Supported variables:
479493

480494
| Variable | Description |
481495
|--------------------------------|---------------------------------------------|
482-
| `$version`, `${version}` | fully generated version |
496+
| `$version`, `${version}` | fully generated version |
483497
| `$major`, `${major}` | MAJOR increment |
484498
| `$minor`, `${minor}` | MINOR increment |
485499
| `$patch`, `${patch}` | PATCH increment |
486500
| `$prerelease`, `${prerelease}` | Prerelease (alpha, beta, release candidate) |
487-
| `$devrelease`, ${devrelease}` | Development release |
501+
| `$devrelease`, `${devrelease}` | Development release |
488502

489503
### `version_files`
490504

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

493507
Commitizen will update its configuration file automatically when bumping,
494-
regarding if the file is present or not in `version_files`.
508+
regardless of whether the file is present or not in `version_files`.
495509

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

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

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

691705
### Recommended use case

0 commit comments

Comments
 (0)