A specification for adding human and machine readable meaning to commit messages.
Format: [optional scope]:
Example feat: allow provided config object to extend other configs
Example fix: fixed the bug in issue #123
Advantage: Automated SemVer version management (major.minor.patch), and automated changelogs.
Commitizen is a Python tool to help with creating conventional commits and automating version control.
pip install commitizen
- Instead of
git commit
usecz commit
and follow the prompts. - You can select the type of commit, plus additional metadata.
- When you decide it is time to create a new version:
- Create a new branch
git checkout -b bump/new_release
- Bump the version and push
pip install commitizen # (if not installed)
cz bump
git push
This will:
- Update the SemVer version number in locations specific in
pyproject.toml
, throughout the codebase.- If a
feat
commit is included, the version is bumped by a minor increment (0.x.0), if onlyfix
is included a patch will be used (0.0.x).
- If a
- Automatically update CHANGELOG.md with all changes since the last version.
- Create a tag matching the version number.
Note: in a repo where you have direct push access, you would simply update on develop and push. As we are using Git-Flow, a PR is necessary.
- Update the version throughout the code (Bumping a Version).
- Click
Draft a new release
. - Click
Choose a tag
, then input the current version number and press enter (this will automatically create a matching tag for your release). - Set the
Release title
tox.x.x
, replacing with your version number. - Add a description if possible, then release.