Conventional Commits
If you’re running a DevPod-based development environment and want to enforce Conventional Commits across your team, this post walks through how to wire up Commitizen and pre-commit automatically — so every developer gets the right hooks installed the moment they enter the container, with zero manual setup.
Why Conventional Commits?
Conventional Commits give your Git history a consistent, machine-readable structure:
This unlocks automated changelogs, semantic versioning, and better collaboration signals in pull requests. Commitizen adds a CLI wizard to guide you through writing them; pre-commit enforces the format at commit time so nothing slips through.
The Stack
- mise — polyglot tool version manager (replaces asdf, nvm, pyenv, etc.)
- Commitizen — conventional commit tooling and CLI (
cz) - pre-commit — Git hook manager
- DevPod — open-source dev containers (sets
$DEVPOD=truein the environment)
Project Structure
Here’s the relevant file layout:
Step 1: Configure mise Tools and an Enter Hook
mise.toml manages all tool versions declaratively, and supports lifecycle hooks. The enter hook fires whenever you cd into the project directory inside the container:
Note: The
hooksfeature requiresexperimental = truein mise settings.
Step 2: Write the Setup Script
The setup script runs on every enter event, but is gated by two conditions: cz not already being installed, and $DEVPOD=true. This means it’s idempotent (safe to run repeatedly) and only runs inside the DevPod environment — not on local machines where the developer may have their own setup:
What each line does:
| Command | Purpose |
|---|---|
push.autoSetupRemote true |
Auto-tracks remote branch on first push |
safe.directory |
Prevents Git “dubious ownership” errors in containers |
pip install --user pipx |
Installs pipx into the user’s Python environment |
pipx install commitizen |
Installs cz in an isolated virtualenv |
pre-commit install |
Registers the pre-commit hook (runs on git commit) |
pre-commit install --hook-type commit-msg |
Registers the commit-msg hook (validates the message) |
Step 3: Configure the pre-commit Hook
.pre-commit-config.yaml pins the Commitizen hook to a specific version and attaches it to the commit-msg stage:
This means when a developer runs git commit, the commit message is validated against Conventional Commits format. If it doesn’t conform, the commit is rejected with a clear error.
How It All Fits Together
Here’s the end-to-end flow when a developer opens the project in DevPod:
Using Commitizen’s Interactive CLI
Instead of writing commit messages manually, developers can use the cz wizard:
This prompts for commit type, scope, description, breaking changes, and more — and writes a perfectly formatted conventional commit message automatically.