iconcommittier

Setup

Automatically Format

To achieve automatically format once git commit -m "..." you need to setup commit-msg hook.

Using a git hooks manager

Checkout husky official documentation

pnpm add husky -D
pnpm husky init

Add hook

Create or edit .husky/commit-msg, add npx --no -- committier edit $1 before commitlint(if you have)

.husky/commit-msg
+ npx --no -- committier edit $1
npx --no -- commitlint --edit $1
Note, there is no '--' before 'edit' command in committier but commitlint.

Integrate commitlint

Checkout commitlint official documentation

Once commitlint installed and setup, you are good to go!

But, if your enabled autoEmoji: true (default: true), set an emoji parser is essential.

Test

Use committier format <message> command for previewing a format.

For example:

pnpm committier format "feat add a button"

Will showing:

 feat: add a button

On this page