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
+6-12Lines changed: 6 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Available options are:
50
50
-`pep440`: [PEP 440][pep440] (**default** and recommended for Python projects)
51
51
-`semver`: [Semantic Versioning][semver] (recommended for non-Python projects)
52
52
53
-
You can also set this in the [configuration](#version_scheme) with `version_scheme = "semver"`.
53
+
You can also set this in the configuration file with `version_scheme = "semver"`.
54
54
55
55
!!! note
56
56
[pep440][pep440] and [semver][semver] are quite similar, although their difference lies in
@@ -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
@@ -178,7 +178,7 @@ The following table illustrates the difference in behavior between the two modes
178
178
179
179
### `--check-consistency`
180
180
181
-
Check whether the versions defined in [`version_files`](#version_files) and the version in Commitizen configuration are consistent before bumping version.
181
+
Check whether the versions defined in [version_files][version_files] and the version in Commitizen configuration are consistent before bumping version.
182
182
183
183
```bash
184
184
cz bump --check-consistency
@@ -207,7 +207,7 @@ from setuptools import setup
207
207
setup(..., version="1.0.5", ...)
208
208
```
209
209
210
-
When you run `cz bump --check-consistency`, Commitizen will verify that the current version in `pyproject.toml` (`1.21.0`) exists in all files listed in [`version_files`](#version_files).
210
+
When you run `cz bump --check-consistency`, Commitizen will verify that the current version in `pyproject.toml` (`1.21.0`) exists in all files listed in [version_files][version_files].
211
211
In this example, it will detect that `setup.py` contains `1.0.5` instead of `1.21.0`, causing the bump to fail.
212
212
213
213
!!! warning "Partial updates on failure"
@@ -457,13 +457,9 @@ Allow the project version to be bumped even when there's no eligible version.
457
457
cz bump --allow-no-commit
458
458
```
459
459
460
-
### `--version-scheme`
461
-
462
-
See [Version Schemes](#version-schemes-version-scheme).
463
-
464
460
### `--tag-format`
465
461
466
-
`tag_format` and [`version_scheme`](#version-schemes-version-scheme) are combined to make Git tag names from versions.
462
+
`tag_format` and [version_scheme][version_scheme] are combined to make Git tag names from versions.
Legacy git tag formats, useful for old projects that changed tag format.
9
-
Tags matching those formats will be recognized as version tags and be included in the changelog.
10
-
Each entry uses the syntax as `tag_format`.
11
-
12
-
### `version_files`
13
-
14
-
Identify the files or glob patterns which should be updated with the new version.
15
-
16
-
Commitizen will update its configuration file automatically when bumping,
17
-
regardless of whether the file is present or not in `version_files`.
18
-
19
-
You may specify the `version_files` in your configuration file.
20
-
21
-
```toml title="pyproject.toml"
22
-
[tool.commitizen]
23
-
version_files = [
24
-
"src/__version__.py",
25
-
]
26
-
```
27
-
28
-
It is also possible to provide a pattern for each file, separated by a colon (e.g. `file:pattern`). See the below example for more details.
29
-
30
-
```toml title="pyproject.toml"
31
-
[tool.commitizen]
32
-
version_files = [
33
-
"packages/*/pyproject.toml:version",
34
-
"setup.json:version",
35
-
]
36
-
```
3
+
## `annotated_tag`
37
4
38
-
#### Example scenario
39
-
40
-
We have a project with the following configuration file `pyproject.toml`:
5
+
When set to `true`, `cz bump` is equivalent to `cz bump --annotated-tag`.
41
6
42
7
```toml title="pyproject.toml"
43
8
[tool.commitizen]
44
-
version_files = [
45
-
"src/__version__.py",
46
-
"packages/*/pyproject.toml:version",
47
-
"setup.json:version",
48
-
]
49
-
```
50
-
51
-
For the reference `"setup.json:version"`, it means that it will look for a file `setup.json` and will only change the lines that contain the substring `"version"`.
52
-
53
-
For example, if the content of `setup.json` is:
54
-
55
-
<!-- DEPENDENCY: repeated_version_number.json -->
56
-
57
-
```json title="setup.json"
58
-
{
59
-
"name": "magictool",
60
-
"version": "1.2.3",
61
-
"dependencies": {
62
-
"lodash": "1.2.3"
63
-
}
64
-
}
65
-
```
66
-
67
-
After running `cz bump 2.0.0`, its content will be updated to:
68
-
69
-
```diff title="setup.json"
70
-
{
71
-
"name": "magictool",
72
-
- "version": "1.2.3",
73
-
+ "version": "2.0.0",
74
-
"dependencies": {
75
-
"lodash": "1.2.3"
76
-
}
77
-
}
9
+
annotated_tag = true
78
10
```
79
11
80
-
!!! note
81
-
Files can be specified using relative (to the execution) paths, absolute paths, or glob patterns.
82
-
83
-
!!! note "Historical note"
84
-
This option was renamed from `files` to `version_files`.
85
-
86
-
### `bump_message`
12
+
## `bump_message`
87
13
88
14
Template used to specify the commit message generated when bumping.
89
15
@@ -94,53 +20,49 @@ Defaults to: `bump: version $current_version → $new_version`
94
20
|`$current_version`| the version existing before bumping |
95
21
|`$new_version`| version generated after bumping |
When set to `true`, `cz bump` is equivalent to `cz bump --changelog`.
30
+
When set to `true`, `cz bump` is equivalent to `cz bump --gpg-sign`. See [`--gpg-sign`](../commands/bump.md#-gpg-sign).
107
31
108
32
```toml title="pyproject.toml"
109
33
[tool.commitizen]
110
-
update_changelog_on_bump = true
34
+
gpg_sign = true
111
35
```
112
36
113
-
### `annotated_tag`
37
+
##`ignored_tag_formats`
114
38
115
-
When set to `true`, `cz bump` is equivalent to `cz bump --annotated-tag`.
39
+
- Type: `list`
40
+
- Default: `[]`
116
41
117
-
```toml title="pyproject.toml"
118
-
[tool.commitizen]
119
-
annotated_tag = true
120
-
```
42
+
Tags matching those formats will be totally ignored and won't raise a warning.
43
+
Each entry uses the syntax as [`tag_format`](#tag_format) with the addition of `*` that will match everything (non-greedy).
121
44
122
-
### `gpg_sign`
45
+
##`major_version_zero`
123
46
124
-
When set to `true`, `cz bump` is equivalent to `cz bump --gpg-sign`. See [`--gpg-sign`](../commands/bump.md#-gpg-sign).
47
+
When set to `true`, `cz bump` is equivalent to `cz bump --major-version-zero`. See [`--major-version-zero`](../commands/bump.md#-major-version-zero).
125
48
126
49
```toml title="pyproject.toml"
127
50
[tool.commitizen]
128
-
gpg_sign = true
51
+
major_version_zero = true
129
52
```
130
53
131
-
### `major_version_zero`
54
+
##`legacy_tag_formats`
132
55
133
-
When set to `true`, `cz bump` is equivalent to `cz bump --major-version-zero`. See [`--major-version-zero`](../commands/bump.md#-major-version-zero).
56
+
- Type: `list`
57
+
- Default: `[]`
134
58
135
-
```toml title="pyproject.toml"
136
-
[tool.commitizen]
137
-
major_version_zero = true
138
-
```
59
+
Legacy git tag formats, useful for old projects that changed tag format.
60
+
Tags matching those formats will be recognized as version tags and be included in the changelog.
61
+
Each entry uses the syntax as `tag_format`.
139
62
140
-
###`pre_bump_hooks`
63
+
## `pre_bump_hooks`
141
64
142
-
A list of optional commands that will run right _after_ updating [`version_files`](#version_files)
143
-
and _before_ actual committing and tagging the release.
65
+
A list of optional commands that will run right *after* updating [`version_files`](#version_files) and *before* actual committing and tagging the release.
144
66
145
67
Useful when you need to generate documentation based on the new version. During
146
68
execution of the script, some environment variables are available:
@@ -163,9 +85,9 @@ pre_bump_hooks = [
163
85
]
164
86
```
165
87
166
-
###`post_bump_hooks`
88
+
## `post_bump_hooks`
167
89
168
-
A list of optional commands that will run right _after_ committing and tagging the release.
90
+
A list of optional commands that will run right *after* committing and tagging the release.
169
91
170
92
Useful when you need to send notifications about a release, or further automate deploying the
171
93
release. During execution of the script, some environment variables are available:
@@ -188,56 +110,106 @@ post_bump_hooks = [
188
110
]
189
111
```
190
112
191
-
###`prerelease_offset`
113
+
## `prerelease_offset`
192
114
193
115
Offset with which to start counting prereleases.
194
116
195
-
Defaults to:`0`
117
+
If not specified, defaults to`0`.
196
118
197
119
```toml title="pyproject.toml"
198
120
[tool.commitizen]
199
121
prerelease_offset = 1
200
122
```
201
123
202
-
### `version_scheme`
124
+
!!! note
125
+
Under some circumstances, a prerelease cannot start with `0`-for example, in embedded projects where individual characters are encoded as bytes. You can specify an offset from which to start counting.
203
126
204
-
See [`--version-scheme`](../commands/bump.md#--version-scheme).
127
+
## `tag_format`
205
128
206
-
### `ignored_tag_formats`
129
+
See [`--tag-format`](../commands/bump.md#-tag-format).
207
130
208
-
- Type: `list`
209
-
- Default: `[]`
210
-
211
-
Tags matching those formats will be totally ignored and won't raise a warning.
212
-
Each entry uses the syntax as [`tag_format`](#tag_format) with the addition of `*`
213
-
that will match everything (non-greedy). [Read more][tag_format]
131
+
## `update_changelog_on_bump`
214
132
133
+
When set to `true`, `cz bump` is equivalent to `cz bump --changelog`.
215
134
216
-
### `major_version_zero`
135
+
```toml title="pyproject.toml"
136
+
[tool.commitizen]
137
+
update_changelog_on_bump = true
138
+
```
217
139
218
-
- Type: `bool`
219
-
- Default: `False`
140
+
## `version_files`
220
141
221
-
If enabled, breaking changes on a `0.x` will remain as a `0.x` version. Otherwise, a breaking change will bump a `0.x`version to `1.0`. [Read more][major-version-zero]
142
+
Identify the files or glob patterns which should be updated with the new version.
222
143
144
+
Commitizen will update its configuration file automatically when bumping,
145
+
regardless of whether the file is present or not in `version_files`.
223
146
224
-
### `prerelease_offset`
147
+
You may specify the `version_files` in your configuration file.
225
148
226
-
- Type: `int`
227
-
- Default: `0`
149
+
```toml title="pyproject.toml"
150
+
[tool.commitizen]
151
+
version_files = [
152
+
"src/__version__.py",
153
+
]
154
+
```
228
155
229
-
In some circumstances, a prerelease cannot start with `0`-for example, in embedded projects where individual characters are encoded as bytes. You can specify an offset from which to start counting. [Read more][prerelease-offset]
156
+
It is also possible to provide a pattern for each file, separated by a colon (e.g. `file:pattern`). See the below example for more details.
230
157
231
-
### `pre_bump_hooks`
158
+
```toml title="pyproject.toml"
159
+
[tool.commitizen]
160
+
version_files = [
161
+
"packages/*/pyproject.toml:version",
162
+
"setup.json:version",
163
+
]
164
+
```
232
165
233
-
- Type: `list[str]`
234
-
- Default: `[]`
166
+
!!! note "Example scenario"
167
+
We have a project with the following configuration file `pyproject.toml`:
168
+
169
+
```toml title="pyproject.toml"
170
+
[tool.commitizen]
171
+
version_files = [
172
+
"src/__version__.py",
173
+
"packages/*/pyproject.toml:version",
174
+
"setup.json:version",
175
+
]
176
+
```
177
+
178
+
For the reference `"setup.json:version"`, it means that it will look for a file `setup.json` and will only change the lines that contain the substring `"version"`.
179
+
180
+
For example, if the content of `setup.json` is:
181
+
182
+
<!-- DEPENDENCY: repeated_version_number.json -->
183
+
184
+
```json title="setup.json"
185
+
{
186
+
"name": "magictool",
187
+
"version": "1.2.3",
188
+
"dependencies": {
189
+
"lodash": "1.2.3"
190
+
}
191
+
}
192
+
```
193
+
194
+
After running `cz bump 2.0.0`, its content will be updated to:
195
+
196
+
```diff title="setup.json"
197
+
{
198
+
"name": "magictool",
199
+
- "version": "1.2.3",
200
+
+ "version": "2.0.0",
201
+
"dependencies": {
202
+
"lodash": "1.2.3"
203
+
}
204
+
}
205
+
```
235
206
236
-
Calls the hook scripts **before** bumping version. [Read more][pre_bump_hooks]
207
+
!!! note
208
+
Files can be specified using relative (to the execution) paths, absolute paths, or glob patterns.
237
209
238
-
### `post_bump_hooks`
210
+
!!! note "Historical note"
211
+
This option was renamed from `files` to `version_files`.
239
212
240
-
- Type: `list[str]`
241
-
- Default: `[]`
213
+
## `version_scheme`
242
214
243
-
Calls the hook scripts **after** bumping the version. [Read more][post_bump_hooks]
215
+
See [`--version-scheme`](../commands/bump.md#-version-scheme).
0 commit comments