| 1 |
# FAQ |
| 2 |
|
| 3 |
This page contains frequently asked how to questions. |
| 4 |
|
| 5 |
## Support for [`PEP621`](https://peps.python.org/pep-0621/) |
| 6 |
|
| 7 |
`PEP621` establishes a `[project]` definition inside `pyproject.toml` |
| 8 |
|
| 9 |
```toml |
| 10 |
[project] |
| 11 |
name = "spam" |
| 12 |
version = "2.5.1" |
| 13 |
``` |
| 14 |
|
| 15 |
Commitizen provides a [`PEP621` version provider](config/version_provider.md) to get and set version from this field. |
| 16 |
|
| 17 |
You just need to set the proper `version_provider` setting: |
| 18 |
|
| 19 |
```toml |
| 20 |
[project] |
| 21 |
name = "spam" |
| 22 |
version = "2.5.1" |
| 23 |
|
| 24 |
[tool.commitizen] |
| 25 |
version_provider = "pep621" |
| 26 |
``` |
| 27 |
|
| 28 |
## How to revert a bump? |
| 29 |
|
| 30 |
If for any reason, the created tag and changelog were to be undone, this is the snippet: |
| 31 |
|
| 32 |
```sh |
| 33 |
git tag --delete <created_tag> |
| 34 |
git reset HEAD~ |
| 35 |
git reset --hard HEAD |
| 36 |
``` |
| 37 |
|
| 38 |
This will remove the last tag created, plus the commit containing the update to `.cz.toml` and the changelog generated for the version. |
| 39 |
|
| 40 |
In case the commit was pushed to the server, you can remove it by running: |
| 41 |
|
| 42 |
```sh |
| 43 |
git push --delete origin <created_tag> |
| 44 |
``` |
| 45 |
|
| 46 |
## How to handle revert commits? |
| 47 |
|
| 48 |
```sh |
| 49 |
git revert --no-commit <SHA> |
| 50 |
git commit -m "revert: foo bar" |
| 51 |
``` |
| 52 |
|
| 53 |
## I got `Exception [WinError 995] The I/O operation ...` error |
| 54 |
|
| 55 |
This error was caused by a Python bug on Windows. It's been fixed by [cpython #22017](https://github.com/python/cpython/pull/22017), and according to Python's changelog, [3.8.6rc1](https://docs.python.org/3.8/whatsnew/changelog.html#python-3-8-6-release-candidate-1) and [3.9.0rc2](https://docs.python.org/3.9/whatsnew/changelog.html#python-3-9-0-release-candidate-2) should be the accurate versions first contain this fix. In conclusion, upgrade your Python version might solve this issue. |
| 56 |
|
| 57 |
More discussion can be found in issue [#318](https://github.com/commitizen-tools/commitizen/issues/318). |
| 58 |
|
| 59 |
## How to change the tag format ? |
| 60 |
|
| 61 |
You can use the [`legacy_tag_formats`](config/bump.md#legacy_tag_formats) to list old tag formats. |
| 62 |
New bumped tags will be in the new format but old ones will still work for: |
| 63 |
|
| 64 |
- changelog generation (full, incremental and version range) |
| 65 |
- bump new version computation (automatically guessed or increment given) |
| 66 |
|
| 67 |
|
| 68 |
So given if you change from `myproject-$version` to `${version}` and then `v${version}`, |
| 69 |
your Commitizen configuration will look like this: |
| 70 |
|
| 71 |
```toml |
| 72 |
tag_format = "v${version}" |
| 73 |
legacy_tag_formats = [ |
| 74 |
"${version}", |
| 75 |
"myproject-$version", |
| 76 |
] |
| 77 |
``` |
| 78 |
|
| 79 |
## How to avoid warnings for expected non-version tags? |
| 80 |
|
| 81 |
You can explicitly ignore them with [`ignored_tag_formats`](config/bump.md#ignored_tag_formats). |
| 82 |
|
| 83 |
```toml |
| 84 |
tag_format = "v${version}" |
| 85 |
ignored_tag_formats = [ |
| 86 |
"stable", |
| 87 |
"component-*", |
| 88 |
"env/*", |
| 89 |
"v${major}.${minor}", |
| 90 |
] |
| 91 |
``` |