Fundamentals 13 min read

Standardized Git Commit Message Guidelines and Tooling with Commitizen

This article explains the conventional Git commit message format, its components and benefits, and demonstrates how to enforce the standard using tools such as Commitizen, commitlint, husky, and standard-version, providing practical examples and configuration snippets for developers.

360 Tech Engineering
360 Tech Engineering
360 Tech Engineering
Standardized Git Commit Message Guidelines and Tooling with Commitizen

AngularJS documentation recommends a strict git commit format to make history more readable and to generate changelogs automatically.

The commit message consists of a header , optional body , and optional footer . The header contains a type , optional scope , and a subject . The type must be one of feat , fix , docs , style , refactor , build , perf , test , chore , ci , or the special revert . The subject should be a concise, imperative description under 50 characters.

<type>(<scope>): <subject> <body> <footer>

Benefits of this convention include clear first‑line summaries, detailed bodies and footers that explain purpose and impact, easy filtering by type , and automatic changelog generation.

Using Commitizen

Commitizen provides a CLI ( git cz ) that prompts for the required fields. Install it globally:

npm install -g commitizen

Initialize a project with the cz-conventional-changelog adapter:

commitizen init cz-conventional-changelog --save-dev --save-exact

Alternatively, make the repository Commitizen‑friendly by adding a .czrc or config.commitizen entry in package.json :

{
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}

Customizing Prompts with cz‑customizable

Install the customizable adapter and re‑initialize:

npm install cz-customizable --save-dev
commitizen init cz-customizable --save-dev --save-exact --force

Configure a .czrc or .cz-config.js file to define Chinese prompts and commit types.

Linting Commits with commitlint

Install @commitlint/config-conventional and the CLI:

npm i --save-dev @commitlint/config-conventional @commitlint/cli

Create commitlint.config.js :

module.exports = {
  extends: ["@commitlint/config-conventional"],
  rules: {}
};

Use Husky to run commitlint on the commit-msg hook:

module.exports = {
  "hooks": {
    "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
  }
};

Optionally trigger git cz automatically on prepare-commit-msg :

"hooks": {
  "prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
}

Generating CHANGELOG with standard‑version

Install the tool and add a release script:

npm i --save-dev standard-version
{
  "scripts": {
    "release": "standard-version"
  }
}

Running npm run release will bump the version according to commit type and generate a formatted CHANGELOG.md .

All the referenced links and further reading are listed at the end of the original article.

gitcommit-messagecommitizencommitlintstandard-version
360 Tech Engineering
Written by

360 Tech Engineering

Official tech channel of 360, building the most professional technology aggregation platform for the brand.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.