Getting started with Commitizen

Published: Oct 21, 2024 by Isaac Johnson

At more than one tech conference I’ve seen fans of Commitizen push the virtues of the cz CLI. It’s been on my list to dig into for quite some time and this week seemed as good a time as any to check out this system for improving our GIT commit messages.

Installation

I’m going to start by trying to install cz in the latest of my install NodeJS instances, v21.7.3

$ nvm list
       v16.20.2
       v18.20.2
->      v21.7.3
         system
default -> stable (-> v21.7.3)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v21.7.3) (default)
stable -> 21.7 (-> v21.7.3) (default)
lts/* -> lts/iron (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.2
lts/hydrogen -> v18.20.4 (-> N/A)
lts/iron -> v20.15.1 (-> N/A)

I did an install then checked if it was reachable with which cz

$ npm install -g commitizen
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 168 packages in 8s

27 packages are looking for funding
  run `npm fund` for details

$ which cz
/home/builder/.nvm/versions/node/v21.7.3/bin/cz

Without touching anything further, let’s just see what git cz does

builder@LuiGi:~/Workspaces/jekyll-blog$ git cz
On branch 2024-10-commitizen
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   Gemfile
        modified:   app.c3f9f951.js
        modified:   app.c3f9f951.js.map

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        _posts/2024-10-17-commitizen.markdown
        test.js
        test_form2.html
        whitepixel.png

no changes added to commit (use "git add" and/or "git commit -a")

I staged a file (this one actually) and tried git cz again

/content/images/2024/10/commitizen-01.png

I just wrote the word “draft” and i see it took it

builder@LuiGi:~/Workspaces/jekyll-blog$ git log -n 1
commit 6764473a6b1dcc9c90500ca99c91af0dafae523e (HEAD -> 2024-10-commitizen)
Author: Isaac Johnson <isaac.johnson@gmail.com>
Date:   Wed Oct 9 18:48:37 2024 -0500

    draft

But the editor, when using git cz was acting very slow. Not sure if that is the weak wifi where I am or something else. I think there might be something a bit funky with the exit of this app as I needed to ctrl-C in both cases below

builder@LuiGi:~/Workspaces/jekyll-blog$ git cz
[2024-10-commitizen 6764473] draft
 1 file changed, 42 insertions(+)
 create mode 100644 _posts/2024-10-17-commitizen.markdown


^C
builder@LuiGi:~/Workspaces/jekyll-blog$ git cz
On branch 2024-10-commitizen
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   Gemfile
        modified:   _posts/2024-10-17-commitizen.markdown
        modified:   app.c3f9f951.js
        modified:   app.c3f9f951.js.map

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        content/images/2024/10/commitizen-01.png
        test.js
        test_form2.html
        whitepixel.png

no changes added to commit (use "git add" and/or "git commit -a")

^C

Making a repo CZ friendly

So we say it works in a basic sense with nothing. However, the goal here is to improve our overall GIT commit messages, even if this particular repo is just for me.

Let’s use npm to add a changelog adapter

builder@LuiGi:~/Workspaces/jekyll-blog$ commitizen init cz-conventional-changelog --save-dev --save-exact
Attempting to initialize using the npm package cz-conventional-changelog
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

I found I needed to use gitignore.io to create a proper NodeJS .gitignore file (this repo is Ruby) then I went to use git cz again

/content/images/2024/10/commitizen-02.png

The results of the interactive run

builder@LuiGi:~/Workspaces/jekyll-blog$ git cz
cz-cli@4.3.1, cz-conventional-changelog@3.3.0

? Select the type of change that you're committing: feat:     A new feature
? What is the scope of this change (e.g. component or file name): (press enter to skip) just adding content to a draft post
? Write a short, imperative tense description of the change (max 57 chars):
 (40) adding some new details about commitizen
? Provide a longer description of the change: (press enter to skip)
 I've added more content for commitizen including usage and installation notes.  This includes some screenshots and images
? Are there any breaking changes? No
? Does this change affect any open issues? Yes
? Add issue references (e.g. "fix #123", "re #123".):
 #271
[2024-10-commitizen 56d8f28] feat(just adding content to a draft post): adding some new details about commitizen
 2 files changed, 244 insertions(+), 1 deletion(-)

I now have a much improved message compared to my standard “draft’ message

$ git log -n 1
commit 56d8f2802471fb3b4bbc673484330ab6f8ff44d3 (HEAD -> 2024-10-commitizen)
Author: Isaac Johnson <isaac.johnson@gmail.com>
Date:   Wed Oct 9 19:06:11 2024 -0500

    feat(just adding content to a draft post): adding some new details about commitizen

    I've added more content for commitizen including usage and installation notes.  This includes some
    screenshots and images

    #271

I did try their suggestion for enforcing a git precommit message with a hook, but didn’t find it worked

builder@LuiGi:~/Workspaces/jekyll-blog$ git commit
Aborting commit due to empty commit message.
builder@LuiGi:~/Workspaces/jekyll-blog$ chmod 755 .git/hooks/pre-commit-msg
builder@LuiGi:~/Workspaces/jekyll-blog$ git commit
Aborting commit due to empty commit message.
builder@LuiGi:~/Workspaces/jekyll-blog$ chmod 755 .git/hooks/pre-commit
chmod: cannot access '.git/hooks/pre-commit': No such file or directory
builder@LuiGi:~/Workspaces/jekyll-blog$ vi .git/hooks/pre-commit
builder@LuiGi:~/Workspaces/jekyll-blog$ vi .git/hooks/pre-commit.sample
builder@LuiGi:~/Workspaces/jekyll-blog$ cat .git/hooks/pre-commit-msg
#!/bin/bash
exec < /dev/tty && node_modules/.bin/cz --hook || true

I’ll push these NodeJS files up

builder@LuiGi:~/Workspaces/jekyll-blog$ git branch --show-current
2024-10-commitizen
builder@LuiGi:~/Workspaces/jekyll-blog$ git push
fatal: The current branch 2024-10-commitizen has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin 2024-10-commitizen

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

builder@LuiGi:~/Workspaces/jekyll-blog$ darf
git push --set-upstream origin 2024-10-commitizen [enter/↑/↓/ctrl+c]
Enumerating objects: 33, done.
Counting objects: 100% (33/33), done.
Delta compression using up to 16 threads
Compressing objects: 100% (23/23), done.
Writing objects: 100% (23/23), 124.33 KiB | 20.72 MiB/s, done.
Total 23 (delta 13), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (13/13), completed with 6 local objects.
remote:
remote: Create a pull request for '2024-10-commitizen' on GitHub by visiting:
remote:      https://github.com/idjohnson/jekyll-blog/pull/new/2024-10-commitizen
remote:
To github.com:idjohnson/jekyll-blog.git
 * [new branch]      2024-10-commitizen -> 2024-10-commitizen
branch '2024-10-commitizen' set up to track 'origin/2024-10-commitizen'.

Windows

While i pretty much work exclusively in WSL (or on a Mac), i wanted to test in Windows natively

I needed to set up choco then choco install nvm.

From there I installed the same version of NodeJS I was using in the WSL instance

/content/images/2024/10/commitizen-03.png

PS C:\Users\isaac> nvm install 21.7.3
Downloading node.js version 21.7.3 (64-bit)...
Extracting node and npm...
Complete
npm v10.5.0 installed successfully.


Installation complete. If you want to use this version, type

nvm use 21.7.3

That didn’t seem to kick it in

PS C:\Users\isaac\Workspaces\jekyll-blog> npm install
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 168 packages, and audited 170 packages in 6s

27 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 10.5.0 -> 10.9.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.0
npm notice Run npm install -g npm@10.9.0 to update!
npm notice
PS C:\Users\isaac\Workspaces\jekyll-blog> git cz
git: 'cz' is not a git command. See 'git --help'.

The most similar commands are
        am
        fsck
        gc
        mv
        p4
        rm
PS C:\Users\isaac\Workspaces\jekyll-blog> npm install -g

added 1 package in 304ms
PS C:\Users\isaac\Workspaces\jekyll-blog> git cz
git: 'cz' is not a git command. See 'git --help'.

The most similar commands are
        am
        fsck
        gc
        mv
        p4
        rm
PS C:\Users\isaac\Workspaces\jekyll-blog>

Now git cz seemed to want to work after i installed direct with npm

PS C:\Users\isaac\Workspaces\jekyll-blog> npm install -g commitizen
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 168 packages in 10s
PS C:\Users\isaac\Workspaces\jekyll-blog> git cz
No files added to staging! Did you forget to run git add?
PS C:\Users\isaac\Workspaces\jekyll-blog>

Let’s see it in use as well as how it actually is linking to my internal Github issues

Enforcement

As it stands, this does not enforce we use cz. In fact, just a second ago I merged in my content and added the recording, pushing with a short commit message

builder@LuiGi:~/Workspaces/jekyll-blog$ git add _posts/2024-10-17-commitizen.markdown 
builder@LuiGi:~/Workspaces/jekyll-blog$ git add content/images/2024/10/commitzen-05.mp4 
builder@LuiGi:~/Workspaces/jekyll-blog$ git commit -m "add a screen recording, #271"
[2024-10-commitizen 5ddf01e] add a screen recording, #271
 2 files changed, 1 deletion(-)
 create mode 100644 content/images/2024/10/commitzen-05.mp4
builder@LuiGi:~/Workspaces/jekyll-blog$ git push
Enumerating objects: 31, done.
Counting objects: 100% (27/27), done.
Delta compression using up to 16 threads
Compressing objects: 100% (17/17), done.
Writing objects: 100% (17/17), 4.44 MiB | 1.65 MiB/s, done.
Total 17 (delta 12), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (12/12), completed with 6 local objects.
To github.com:idjohnson/jekyll-blog.git
   695d55e..5ddf01e  2024-10-commitizen -> 2024-10-commitizen

Commitizen in Project IDX

Let’s try our Remote Coding environment in Google’s Project IDX.

I’ll fire up a workspace. Since it has been a while, it needs to unarchive first

/content/images/2024/10/commitizen-04b.png

I now can see my code and fire up a terminal

/content/images/2024/10/commitizen-05.png

While it does not have nvm, I do see it is a relatively current version of NodeJS

expressuploader-2530664:~/expressUploader{main}$ nvm list
bash: nvm: command not found
expressuploader-2530664:~/expressUploader{main}$ node -v
v20.11.1
expressuploader-2530664:~/expressUploader{main}$ 

I ran the same install steps as before in the terminal

/content/images/2024/10/commitizen-06.png

It works just great:

CZ toml

I added a TOML file would to versioning

$ cat .cz.toml
[tool.commitizen]
version = "0.1.0"
update_changelog_on_bump = true

By default, a cz commit doesn’t the behavior

builder@LuiGi:~/Workspaces/jekyll-blog$ git add content/images/2024/10/
builder@LuiGi:~/Workspaces/jekyll-blog$ git add _posts/2024-10-17-commitizen.markdown
builder@LuiGi:~/Workspaces/jekyll-blog$ git add .cz.toml
builder@LuiGi:~/Workspaces/jekyll-blog$ git cz
cz-cli@4.3.1, cz-conventional-changelog@3.3.0

? Select the type of change that you're committing: fix:      A bug fix
? What is the scope of this change (e.g. component or file name): (press enter to skip) adding some blog contents
? Write a short, imperative tense description of the change (max 68 chars):
 (35) updates about ProjectIDX, toml file
? Provide a longer description of the change: (press enter to skip)
 Added the CZ .cz.toml file, added new images and new markdown content
? Are there any breaking changes? No
? Does this change affect any open issues? Yes
? Add issue references (e.g. "fix #123", "re #123".):
 #271
[2024-10-commitizen 08c842b] fix(adding some blog contents): updates about ProjectIDX, toml file
 6 files changed, 36 insertions(+)
 create mode 100644 .cz.toml
 create mode 100644 content/images/2024/10/commitizen-04.png
 create mode 100644 content/images/2024/10/commitizen-05.png
 create mode 100644 content/images/2024/10/commitizen-06.png
 create mode 100644 content/images/2024/10/commitizen-07.mp4
builder@LuiGi:~/Workspaces/jekyll-blog$ git log -n1
commit 08c842bf49ba18584d4a7bcbae37260fd295d750 (HEAD -> 2024-10-commitizen)
Author: Isaac Johnson <isaac.johnson@gmail.com>
Date:   Thu Oct 10 16:51:38 2024 -0500

    fix(adding some blog contents): updates about ProjectIDX, toml file

    Added the CZ .cz.toml file, added new images and new markdown content

    #271

Homebrew

We can install Commitizen via Homebrew. Since I had already used the NodeJS version in my primary hosts, I used my VSCode Devcontainer to install Commitizen with homebrew

I added Homebrew

root@34c09b7cd1a5:/workspaces/jekyll-blog# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
==> This script will install:
/home/linuxbrew/.linuxbrew/bin/brew
/home/linuxbrew/.linuxbrew/share/doc/homebrew
/home/linuxbrew/.linuxbrew/share/man/man1/brew.1
/home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew
/home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew
/home/linuxbrew/.linuxbrew/Homebrew

Press RETURN/ENTER to continue or any other key to abort:
==> /bin/chown -R root:root /home/linuxbrew/.linuxbrew/Homebrew
==> Downloading and installing Homebrew...
==> Updating Homebrew...
Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:
    echo >> /root/.bashrc
    echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /root/.bashrc
    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- Install Homebrew's dependencies if you have sudo access:
    sudo apt-get install build-essential
  For more information, see:
    https://docs.brew.sh/Homebrew-on-Linux
- We recommend that you install GCC:
    brew install gcc
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

root@34c09b7cd1a5:/workspaces/jekyll-blog# echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /root/.bashrc
root@34c09b7cd1a5:/workspaces/jekyll-blog# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Then added Commitizen with the brew formulae.

root@34c09b7cd1a5:/workspaces/jekyll-blog# brew install commitizen
==> Downloading https://ghcr.io/v2/homebrew/core/commitizen/manifests/3.29.1-1
######################################################################################################## 100.0%
==> Fetching dependencies for commitizen: libyaml, mpdecimal, ca-certificates, openssl@3, ncurses, readline, zlib, sqlite, xz, berkeley-db@5, libedit, krb5, libtirpc, libnsl, bzip2, expat, libffi, libxcrypt, unzip and python@3.13
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/manifests/0.2.5
######################################################################################################## 100.0%
==> Fetching libyaml
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/blobs/sha256:354677a745b6c62109e792ddbd0cbdaf9e6a471d8
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/manifests/4.0.0-1
######################################################################################################## 100.0%
==> Fetching mpdecimal
==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/blobs/sha256:ca79318fa094531bd57b3f07d5b8574cd9986ba
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2024-09-24
######################################################################################################## 100.0%
==> Fetching ca-certificates
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:212f2576348d5f5797d8d3905eb70d0d9
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.3.2
######################################################################################################## 100.0%
==> Fetching openssl@3
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:1c54baa903d258fba6b5aef6818c5f282681d37
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/manifests/6.5
######################################################################################################## 100.0%
==> Fetching ncurses
==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/blobs/sha256:7c49662d0f319baec24475d38210b2f9c754b2ec1
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.13
######################################################################################################## 100.0%
==> Fetching readline
==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:099378b496dd58f6a0fdb09e4c32d2ccae5631c0
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/manifests/1.3.1
######################################################################################################## 100.0%
==> Fetching zlib
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/blobs/sha256:38f2469db2ce63b70855a98e5ee27b5b5a92874e5254
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/manifests/3.46.1
######################################################################################################## 100.0%
==> Fetching sqlite
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/blobs/sha256:108cff91d8599c1d25f3097655c539c914cce311f1
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.6.3
######################################################################################################## 100.0%
==> Fetching xz
==> Downloading https://ghcr.io/v2/homebrew/core/xz/blobs/sha256:360e9e63603136e0a4af1c9d0a6c28429fca9008fa5210
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/berkeley-db/5/manifests/5.3.28_1
######################################################################################################## 100.0%
==> Fetching berkeley-db@5
==> Downloading https://ghcr.io/v2/homebrew/core/berkeley-db/5/blobs/sha256:c0e2906cc6657dc497fec75629560b0a404
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libedit/manifests/20240808-3.1
######################################################################################################## 100.0%
==> Fetching libedit
==> Downloading https://ghcr.io/v2/homebrew/core/libedit/blobs/sha256:8e574e7c9d236e3c6d12b208934ebe3159e27b50b
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/krb5/manifests/1.21.3
######################################################################################################## 100.0%
==> Fetching krb5
==> Downloading https://ghcr.io/v2/homebrew/core/krb5/blobs/sha256:f5b4cafedb315e92a31a0a5d87e33f7826952bcc5c09
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libtirpc/manifests/1.3.5
######################################################################################################## 100.0%
==> Fetching libtirpc
==> Downloading https://ghcr.io/v2/homebrew/core/libtirpc/blobs/sha256:91acf8d2991b6c027d780f8662e81f154c6101d6
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libnsl/manifests/2.0.1-1
######################################################################################################## 100.0%
==> Fetching libnsl
==> Downloading https://ghcr.io/v2/homebrew/core/libnsl/blobs/sha256:fa7613b30e9bfe15166339d119c19115ec21f13cea
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/bzip2/manifests/1.0.8-2
######################################################################################################## 100.0%
==> Fetching bzip2
==> Downloading https://ghcr.io/v2/homebrew/core/bzip2/blobs/sha256:a731afa70daaafec28359b4f10f1c68455c1955ae66
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/expat/manifests/2.6.3
######################################################################################################## 100.0%
==> Fetching expat
==> Downloading https://ghcr.io/v2/homebrew/core/expat/blobs/sha256:f2977263cdc1c6c153a5459eaee29016739f9cb727c
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/manifests/3.4.6
######################################################################################################## 100.0%
==> Fetching libffi
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:798c3983a917698d5dd0c60063e7b8c1e5b4fc377d
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxcrypt/manifests/4.4.36
######################################################################################################## 100.0%
==> Fetching libxcrypt
==> Downloading https://ghcr.io/v2/homebrew/core/libxcrypt/blobs/sha256:ad1c4b570d7a66046038c13345b54337d858a2d
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/unzip/manifests/6.0_8
######################################################################################################## 100.0%
==> Fetching unzip
==> Downloading https://ghcr.io/v2/homebrew/core/unzip/blobs/sha256:baf15e19852a0f9756e3302fa6f3866eaeccc06730c
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.13/manifests/3.13.0_1
######################################################################################################## 100.0%
==> Fetching python@3.13
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.13/blobs/sha256:856c9c245e10cac940a6bf36af6ecf1a321ad
######################################################################################################## 100.0%
==> Fetching commitizen
==> Downloading https://ghcr.io/v2/homebrew/core/commitizen/blobs/sha256:033b844db7befc7348f126164632a507e4a045
######################################################################################################## 100.0%
==> Installing dependencies for commitizen: libyaml, mpdecimal, ca-certificates, openssl@3, ncurses, readline, zlib, sqlite, xz, berkeley-db@5, libedit, krb5, libtirpc, libnsl, bzip2, expat, libffi, libxcrypt, unzip and python@3.13
==> Installing commitizen dependency: libyaml
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/manifests/0.2.5
Already downloaded: /root/.cache/Homebrew/downloads/5f6b0af1730aa1bc02f8021c90ed7ffe988eeba95eec83e6c828f77332ba6406--libyaml-0.2.5.bottle_manifest.json
==> Pouring libyaml--0.2.5.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/libyaml/0.2.5: 12 files, 394.2KB
==> Installing commitizen dependency: mpdecimal
==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/manifests/4.0.0-1
Already downloaded: /root/.cache/Homebrew/downloads/7b63c3b34bee402290af49fac829a6682ab45ea5c9258b6fe03b590a03a4c4a9--mpdecimal-4.0.0-1.bottle_manifest.json
==> Pouring mpdecimal--4.0.0.x86_64_linux.bottle.1.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/mpdecimal/4.0.0: 22 files, 802.0KB
==> Installing commitizen dependency: ca-certificates
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2024-09-24
Already downloaded: /root/.cache/Homebrew/downloads/338dad7c2ff7c822cda7c417944521589856741c0fbd7a7f07b88a18d7fb7e05--ca-certificates-2024-09-24.bottle_manifest.json
==> Pouring ca-certificates--2024-09-24.all.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/ca-certificates/2024-09-24: 4 files, 252.9KB
==> Installing commitizen dependency: openssl@3
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.3.2
Already downloaded: /root/.cache/Homebrew/downloads/15a43beab5e5017b1a9fe7584ff44a48195632fd196c23ee0e5e7ecf67e9ef2a--openssl@3-3.3.2.bottle_manifest.json
==> Pouring openssl@3--3.3.2.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/openssl@3/3.3.2: 6,994 files, 38.9MB
==> Installing commitizen dependency: ncurses
==> Downloading https://ghcr.io/v2/homebrew/core/ncurses/manifests/6.5
Already downloaded: /root/.cache/Homebrew/downloads/b2f8ce4e08b15832435170efd265346225ee388d5baab3d5c50e3a77c5673b5a--ncurses-6.5.bottle_manifest.json
==> Pouring ncurses--6.5.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/ncurses/6.5: 4,037 files, 10.9MB
==> Installing commitizen dependency: readline
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.13
Already downloaded: /root/.cache/Homebrew/downloads/aa1afa38997a2866d91c81fdda8b36d436cd4ea7a82aed07d13c83c56eb3460e--readline-8.2.13.bottle_manifest.json
==> Pouring readline--8.2.13.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/readline/8.2.13: 51 files, 2MB
==> Installing commitizen dependency: zlib
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/manifests/1.3.1
Already downloaded: /root/.cache/Homebrew/downloads/f68d0caf232d52f2aa586abefbbfd7e958e384d84f3967008fa83de94b5f10ae--zlib-1.3.1.bottle_manifest.json
==> Pouring zlib--1.3.1.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/zlib/1.3.1: 14 files, 476.0KB
==> Installing commitizen dependency: sqlite
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/manifests/3.46.1
Already downloaded: /root/.cache/Homebrew/downloads/b34f1b968c8d3adc8763b7151754bc4f348c94372d89d1ae23cd11b643b7bdb2--sqlite-3.46.1.bottle_manifest.json
==> Pouring sqlite--3.46.1.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/sqlite/3.46.1: 13 files, 6.2MB
==> Installing commitizen dependency: xz
==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.6.3
Already downloaded: /root/.cache/Homebrew/downloads/e68799185cc17334108ba286ba8c3df0587c9fd8375647d85f7157b62a797599--xz-5.6.3.bottle_manifest.json
==> Pouring xz--5.6.3.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/xz/5.6.3: 97 files, 2MB
==> Installing commitizen dependency: berkeley-db@5
==> Downloading https://ghcr.io/v2/homebrew/core/berkeley-db/5/manifests/5.3.28_1
Already downloaded: /root/.cache/Homebrew/downloads/17e4e0def00184b561c8a490b5c0813a7c4f5e1365eb2e927570786eb4e05e09--berkeley-db@5-5.3.28_1.bottle_manifest.json
==> Pouring berkeley-db@5--5.3.28_1.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/berkeley-db@5/5.3.28_1: 5,272 files, 87.7MB
==> Installing commitizen dependency: libedit
==> Downloading https://ghcr.io/v2/homebrew/core/libedit/manifests/20240808-3.1
Already downloaded: /root/.cache/Homebrew/downloads/29a41913ba5a0184006508d5ff85032fddf36d6ff90f0dfd2faea711a1c12ac0--libedit-20240808-3.1.bottle_manifest.json
==> Pouring libedit--20240808-3.1.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/libedit/20240808-3.1: 55 files, 795.6KB
==> Installing commitizen dependency: krb5
==> Downloading https://ghcr.io/v2/homebrew/core/krb5/manifests/1.21.3
Already downloaded: /root/.cache/Homebrew/downloads/c5793441ca90aa09420dddd84f19d4aaf86da4f0b3f60c84940d77b1cb4c6863--krb5-1.21.3.bottle_manifest.json
==> Pouring krb5--1.21.3.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/krb5/1.21.3: 164 files, 5.3MB
==> Installing commitizen dependency: libtirpc
==> Downloading https://ghcr.io/v2/homebrew/core/libtirpc/manifests/1.3.5
Already downloaded: /root/.cache/Homebrew/downloads/0e24b7707d61a38f8d6b8e824b5b9453da14353f369e3487d3da4b972d1fe06e--libtirpc-1.3.5.bottle_manifest.json
==> Pouring libtirpc--1.3.5.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/libtirpc/1.3.5: 86 files, 1MB
==> Installing commitizen dependency: libnsl
==> Downloading https://ghcr.io/v2/homebrew/core/libnsl/manifests/2.0.1-1
Already downloaded: /root/.cache/Homebrew/downloads/acb99d1f2d66c043ffb37b99aafd629564bd4c173a307d10b9b6c5bfa360130d--libnsl-2.0.1-1.bottle_manifest.json
==> Pouring libnsl--2.0.1.x86_64_linux.bottle.1.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/libnsl/2.0.1: 18 files, 195.8KB
==> Installing commitizen dependency: bzip2
==> Downloading https://ghcr.io/v2/homebrew/core/bzip2/manifests/1.0.8-2
Already downloaded: /root/.cache/Homebrew/downloads/c1a79a32cc9082c99fc318e6b2596b8b1f6e99abacb32bcbe88f979e4be5e4ea--bzip2-1.0.8-2.bottle_manifest.json
==> Pouring bzip2--1.0.8.x86_64_linux.bottle.2.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/bzip2/1.0.8: 32 files, 607.5KB
==> Installing commitizen dependency: expat
==> Downloading https://ghcr.io/v2/homebrew/core/expat/manifests/2.6.3
Already downloaded: /root/.cache/Homebrew/downloads/a48c2b59c4ca7abe5fc9c82452a6d4791cfb0b91dd45a381a4987b10ddd4dd35--expat-2.6.3.bottle_manifest.json
==> Pouring expat--2.6.3.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/expat/2.6.3: 23 files, 903.4KB
==> Installing commitizen dependency: libffi
==> Downloading https://ghcr.io/v2/homebrew/core/libffi/manifests/3.4.6
Already downloaded: /root/.cache/Homebrew/downloads/2d373c9b8d06ce1d9634d08a4be79711fd482169e98bc830509aa28f3f07926d--libffi-3.4.6.bottle_manifest.json
==> Pouring libffi--3.4.6.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.6: 19 files, 768KB
==> Installing commitizen dependency: libxcrypt
==> Downloading https://ghcr.io/v2/homebrew/core/libxcrypt/manifests/4.4.36
Already downloaded: /root/.cache/Homebrew/downloads/950e230307625f9e57d74f0076caab42b6c67a325c70b83efa2c9cc84be1f839--libxcrypt-4.4.36.bottle_manifest.json
==> Pouring libxcrypt--4.4.36.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/libxcrypt/4.4.36: 25 files, 371.8KB
==> Installing commitizen dependency: unzip
==> Downloading https://ghcr.io/v2/homebrew/core/unzip/manifests/6.0_8
Already downloaded: /root/.cache/Homebrew/downloads/b9a98c1a65dea38eb0bb5d9106a5758ed0ff17635811bd7f7cd6be5908c2961b--unzip-6.0_8.bottle_manifest.json
==> Pouring unzip--6.0_8.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/unzip/6.0_8: 17 files, 437.9KB
==> Installing commitizen dependency: python@3.13
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.13/manifests/3.13.0_1
Already downloaded: /root/.cache/Homebrew/downloads/9b17bb2e9c677d8c64b5adc51ee37d3de0d768a86fc8a8526255a2bf36aeb114--python@3.13-3.13.0_1.bottle_manifest.json
==> Pouring python@3.13--3.13.0_1.x86_64_linux.bottle.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/python@3.13/3.13.0_1/bin/python3.13 -Im ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/python@3.13/3.13.0_1/bin/python3.13 -Im pip install -v --no-index --upgra
🍺  /home/linuxbrew/.linuxbrew/Cellar/python@3.13/3.13.0_1: 2,808 files, 69.4MB
==> Installing commitizen
==> Pouring commitizen--3.29.1.x86_64_linux.bottle.1.tar.gz
==> Caveats
Bash completion has been installed to:
  /home/linuxbrew/.linuxbrew/etc/bash_completion.d
==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/commitizen/3.29.1: 473 files, 4.1MB
==> Running `brew cleanup commitizen`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> commitizen
Bash completion has been installed to:
  /home/linuxbrew/.linuxbrew/etc/bash_completion.d

This time, cz init worked

/content/images/2024/10/commitizen-04.png

This time we setup a toml file, semver and a pre-commit hook

root@34c09b7cd1a5:/workspaces/jekyll-blog# commitizen init
bash: commitizen: command not found
root@34c09b7cd1a5:/workspaces/jekyll-blog# cz init
Welcome to commitizen!

Answer the questions to configure your project.
For further configuration visit:

https://commitizen-tools.github.io/commitizen/config/

? Please choose a supported config file:  .cz.toml
? Please choose a cz (commit rule): (default: cz_conventional_commits) cz_conventional_commits
? Choose the source of the version: npm: Get and set version from package.json:project.version field
No Existing Tag. Set tag to v0.0.1
? Choose version scheme:  semver
? Please enter the correct version format: (default: "$version")
? Create changelog automatically on bump Yes
? Keep major version zero (0.x) during breaking changes Yes
? What types of pre-commit hook you want to install? (Leave blank if you don't want to install) done

You can bump the version running:

        cz bump

Configuration complete 🚀

Using the brew installed version (which I believe is the same as the Python one), we use git cz c for commits, not just git cz

root@34c09b7cd1a5:/workspaces/jekyll-blog# git cz c
? Select the type of change you are committing feat: A new feature. Correlates with MINOR in SemVer
? What is the scope of this change? (class or file name): (press [enter] to skip)
 Added notes on brew install
? Write a short and imperative summary of the code changes: (lower case and no period)
 Added brew steps, added toml file, updated devcontainer
? Provide additional contextual information about the code changes: (press [enter] to skip)
 tested in devcontainer
? Is this a BREAKING CHANGE? Correlates with MAJOR in SemVer No
? Footer. Information about Breaking Changes and reference issues that this commit closes: (press [enter] to skip)
 #271

feat(Added-notes-on-brew-install): Added brew steps, added toml file, updated devcontainer

tested in devcontainer

#271


[2024-10-commitizen 3ecca56a] feat(Added-notes-on-brew-install): Added brew steps, added toml file, updated devcontainer
 8 files changed, 403 insertions(+), 4 deletions(-)
 create mode 100644 .cz.toml
 create mode 100755 .devcontainer/getpass.sh
 create mode 100755 .devcontainer/listpass.sh
 create mode 100755 .devcontainer/setpass.sh
 create mode 100644 content/images/2024/10/commitizen-04.png

Commit successful!

Which created a commit as expected

root@34c09b7cd1a5:/workspaces/jekyll-blog# git log -n1 
commit 3ecca56a2a886895d62d0992c3b6f4850b61982b (HEAD -> 2024-10-commitizen)
Author: Isaac Johnson <isaac.johnson@gmail.com>
Date:   Mon Oct 14 12:11:50 2024 +0000

    feat(Added-notes-on-brew-install): Added brew steps, added toml file, updated devcontainer
    
    tested in devcontainer
    
    #271

Summary

I find Commitizen a very nice tool to help us encourage good commit compliance. I like the formatting and while I could not get the pre-commit hooks to work reliably, I could imagine that getting sorted out.

At the end of the day, my bigger issue is this just isn’t how I work. I believe in committing often while I work and I really don’t care if my commit says “try again” or lists all the files. If I have to type a lot when I commit then it just delays the testing.

However, I’m not into slop I do believe in really good Pull Requests. I have always felt that the real meat of the update should be in one’s code comments, REAMDE.md and then one’s PR. I could care less if a person slapped 50 commits in a PR to get the work done or just two; at the end of the day, I expect a squash on merge anyhow.

Perhaps the git cz approach is for mainline development or shared project branches.

GIT Developer Commitizen

Have something to add? Feedback? You can use the feedback form

Isaac Johnson

Isaac Johnson

Cloud Solutions Architect

Isaac is a CSA and DevOps engineer who focuses on cloud migrations and devops processes. He also is a dad to three wonderful daughters (hence the references to Princess King sprinkled throughout the blog).

Theme built by C.S. Rhymes