Skip to content

Instantly share code, notes, and snippets.

@woile
Last active July 30, 2021 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woile/bda6decd071f567d3814ca3fe2d5254a to your computer and use it in GitHub Desktop.
Save woile/bda6decd071f567d3814ca3fe2d5254a to your computer and use it in GitHub Desktop.
Commitizen example
#!/bin/bash
cr=$(echo $'\n.')
cr=${cr%.}
trap 'read -rep $"$cr$ $BASH_COMMAND $cr"' DEBUG
cd /tmp
mkdir cz-example/
cd cz-example/
git init
# --------------------------------------------
INSTALLATION="
python -m pip install -U commitizen
"
cat <<EOT > .cz.toml
[tool.commitizen]
version = "0.0.1"
EOT
cat .cz.toml
git add .cz.toml
# --------------------------------------------
touch users.py
git add users.py
TRADE_OFF="
Commit message follows a structure instead of free text.
We specify the type of increment introduced by this commit beforehand.
"
git commit -am "feat: add users component"
# --------------------------------------------
touch employees.py
git add employees.py
git commit -am "feat: add employees component"
# --------------------------------------------
cz bump --yes --changelog
# --------------------------------------------
ls
# --------------------------------------------
cat CHANGELOG.md
# --------------------------------------------
git rm employees.py
git commit -am "feat: add employees component
BREAKING CHANGE: employees no longer supported, just user users now, the interface is the same
"
# --------------------------------------------
cz bump --yes --changelog
# --------------------------------------------
cat CHANGELOG.md
# --------------------------------------------
rm -rf /tmp/cz-example
GITHUB="https://github.com/commitizen-tools/commitizen"
PRESENTATION="https://gist.github.com/Woile/bda6decd071f567d3814ca3fe2d5254a"
THANKS="https://twitter.com/santiwilly"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment