Skip to content

paradixe/commit-normalize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

commit-normalize

A git commit-msg hook that enforces and auto-corrects Conventional Commits format.

Format

type(scope): description

Supported types: feat, fix, chore, docs, style, refactor, test, ci, perf, build

What it does

  • Lowercases the type prefix (FEAT:feat:)
  • Lowercases the first character of the description
  • Trims leading/trailing whitespace and collapses multiple spaces
  • Auto-corrects missing colons (feat add loginfeat: add login)
  • Enforces max subject length (default: 72 chars)
  • Rejects unknown types and empty descriptions

Install

# Install into the current repo
./install.sh

# Install into another repo
./install.sh /path/to/repo

Configure

Edit commit-normalize.config.json in the repo root:

{
  "types": ["feat", "fix", "chore", "docs", "style", "refactor", "test", "ci", "perf", "build"],
  "maxSubjectLength": 72,
  "requireScope": false,
  "autoCorrect": true
}

Batch normalize existing history

# Normalize all commits from root
./normalize.sh

# Normalize commits after a specific ref
./normalize.sh main

Warning: This rewrites git history. Only use on unpublished branches.

Tests

bash tests/test_commit_msg.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages