You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/commands/bump.md
+49-34Lines changed: 49 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,7 +111,7 @@ Commitizen supports the [PEP 440][pep440] version format, which includes several
111
111
112
112
### `--files-only`
113
113
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.
115
115
116
116
```bash
117
117
cz bump --files-only
@@ -128,7 +128,7 @@ cz bump --changelog
128
128
### `--prerelease`
129
129
130
130
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 bump’s 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
132
132
non-negative number. Supported options for `--prerelease` are the following phase names `alpha`, `beta`, or
133
133
`rc` (release candidate). For more details, refer to the
134
134
[Python Packaging User Guide](https://packaging.python.org/en/latest/specifications/version-specifiers/#pre-releases).
@@ -222,10 +222,11 @@ In this example, it will detect that `setup.py` contains `1.0.5` instead of `1.2
222
222
```
223
223
224
224
2. Manually update the version in `setup.py` to match the version in `pyproject.toml`:
225
-
```python title="setup.py"
225
+
```diff title="setup.py"
226
226
from setuptools import setup
227
227
228
-
setup(..., version="1.21.0", ...)
228
+
- setup(..., version="1.0.5", ...)
229
+
+ setup(..., version="1.21.0", ...)
229
230
```
230
231
231
232
3. Run the bump command again:
@@ -280,19 +281,20 @@ Any other messages generated by `cz bump` will be sent to `stderr`.
280
281
When this flag is used, `--changelog` is implied.
281
282
However, it is recommended to set `--changelog` (or the setting `update_changelog_on_bump`) explicitly when the option `--changelog-to-stdout` is used.
282
283
283
-
#### Useful scenarios
284
+
!!! note "Useful scenarios"
285
+
Pipe the newly created changelog to another tool.
284
286
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.
287
+
The output can be redirected to an auditing system, or used to create a GitHub Release, etc.
If `--git-output-to-stderr` is used, git commands output is redirected to `stderr`.
295
+
Redirects gitcommands output to `stderr`.
294
296
295
-
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.
296
298
297
299
For example, `git commit` output may pollute `stdout`, so it is recommended to use this flag when piping the output to a file.
298
300
@@ -305,7 +307,7 @@ Useful to combine with code formatters, like [Prettier](https://prettier.io/).
305
307
306
308
### `--major-version-zero`
307
309
308
-
Breaking changes does not bump the major version number.
310
+
Breaking changes do not bump the major version number.
309
311
310
312
Say you have a project with the version `0.1.x` and you commit a breaking change like this:
311
313
@@ -343,7 +345,7 @@ Then the version of your project will be bumped to `0.2.0` instead of `1.0.0`.
343
345
344
346
### `--gpg-sign`
345
347
346
-
Create gpg signed tags.
348
+
Creates gpg signed tags.
347
349
348
350
```bash
349
351
cz bump --gpg-sign
@@ -366,18 +368,16 @@ See [the template customization section](../customization.md#customizing-the-cha
366
368
367
369
### `--build-metadata`
368
370
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.
371
+
Specifies additional metadata in the version string.
370
372
371
373
```bash
374
+
# creates a version like `1.1.2+yourmetadata`.
372
375
cz bump --build-metadata yourmetadata
373
376
```
374
377
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.
378
+
!!! note "Example usage"
379
+
- Git hash in version
380
+
- Labeling the version with additional metadata.
381
381
382
382
!!! note
383
383
Commitizen ignores everything after `+` when it bumps the version.
@@ -391,16 +391,19 @@ This can be useful for multiple things
391
391
- 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.
392
392
- It might be problematic having the metadata in place when doing upgrades depending on what tool you use.
393
393
394
+
!!! warning
395
+
This parameter is not compatible with `--local-version` as it uses the same part of the version string.
396
+
394
397
### `--get-next`
395
398
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`.
399
+
Similar to `--dry-run` but only outputs the next version.
398
400
399
401
```bash
402
+
# outputs 1.0.1 if the current version is 1.0.0 and the increment is PATCH
400
403
cz bump --get-next
401
404
```
402
405
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.
406
+
Useful for determining the next version based on CI for non-production environments/builds.
404
407
405
408
!!! note "Compare with `--dry-run`"
406
409
`--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 +429,27 @@ Will only output the next version, e.g., `1.2.3`. This can be useful for determi
426
429
427
430
### `--allow-no-commit`
428
431
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]`
432
+
Allow the project version to be bumped even when there's no eligible version.
430
433
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
434
+
!!! note "Example usage"
435
+
```sh
436
+
# bump a minor version even when there's only bug fixes, documentation changes or even no commits
434
437
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
-
```
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`.
| commitizen-tools: What can we gain from crafting a git message convention | Wei Lee | Taipei.py 2020 June Meetup, Remote Python Pizza 2020 | English |[slides](https://speakerdeck.com/leew/commitizen-tools-what-can-we-gain-from-crafting-a-git-message-convention-at-taipey-dot-py)|
8
-
| Automating release cycles | Santiago Fraire | PyAmsterdam June 24, 2020, Online | English |[slides](https://woile.github.io/commitizen-presentation/)|
9
-
|[Automatizando Releases con Commitizen y Github Actions][automatizando]| Santiago Fraire | PyConAr 2020, Remote | Español |[slides](https://woile.github.io/automating-releases-github-actions-presentation/#/)|
|[Atomic Commits: An Easy & Proven Way to Manage & Automate Release Process](https://www.youtube.com/watch?v=IxzN9ClXhs8)| Wei Lee | COSCUP 2023 | Taiwanese Mandarin |[slides](https://speakerdeck.com/leew/atomic-commits-an-easy-and-proven-way-to-manage-and-automate-release-process)|
8
+
| commitizen-tools: What can we gain from crafting a git message convention | Wei Lee | Taipei.py 2020 June Meetup, Remote Python Pizza 2020 | English |[slides](https://speakerdeck.com/leew/commitizen-tools-what-can-we-gain-from-crafting-a-git-message-convention-at-taipey-dot-py)|
9
+
| Automating release cycles | Santiago Fraire | PyAmsterdam June 24, 2020, Online | English |[slides](https://woile.github.io/commitizen-presentation/)|
10
+
|[Automatizando Releases con Commitizen y Github Actions][automatizando]| Santiago Fraire | PyConAr 2020, Remote | Español |[slides](https://woile.github.io/automating-releases-github-actions-presentation/#/)|
10
11
11
12
## Articles
12
13
13
-
-[Python Table Manners - Commitizen: 規格化 commit message](https://lee-w.github.io/posts/tech/2020/03/python-table-manners-commitizen/) (Written in Traditional Mandarin)
14
+
-[Python Table Manners - Commitizen: 規格化 commit message](https://blog.wei-lee.me/posts/tech/2020/03/python-table-manners-commitizen/) (Written in Traditional Mandarin)
14
15
-[Automating semantic release with commitizen](https://woile.dev/posts/automating-semver-releases-with-commitizen/) (English)
15
16
-[How to Write Better Git Commit Messages – A Step-By-Step Guide](https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/?utm_source=tldrnewsletter) (English)
16
17
-[Continuous delivery made easy (in Python)](https://medium.com/dev-genius/continuous-delivery-made-easy-in-python-c085e9c82e69)
0 commit comments