gitru
Git Commit Message Validation Tool
gitru is a lightweight, configurable Git commit message validation tool designed to enforce Conventional Commits standards across development teams.
Installation
Method 1: (Recommended)
With Rust toolchain installed:
Method 2:
Download pre-built binary:
- Get latest release for your OS
- Add to system PATH
- Set executable permissions:
Usage
Install hook and initialize configuration:
Command breakdown:
ii=install(sets up git hook) +init(creates config template)- Execute separately:
gitru install commit-msgandgitru init commit-msg
For more options:
Workflow
After installation:
- Git hook installed to
.git/hooks/commit-msg - Configuration template created at
.commit-msg-rule.toml
Customize validation rules by editing .commit-msg-rule.toml.
You can optionally modify, delete, or comment out the options that do not require validation.
configuration file example:
# The Conventional Commits
#
# ╔═════════════════════════════════════════════════╗
# ║ COMMIT FORMAT TEMPLATE ║
# ╠═════════════════════════════════════════════════╣
# ║ type(optional scope): subject ║
# ║ ║
# ║ [optional body] ║
# ║ ║
# ║ [optional footer] ║
# ║ - BREAKING CHANGE: xxxxx ║
# ║ - Closes #issue ║
# ╚═════════════════════════════════════════════════╝
#
[]
= "1.0.0"
= true
= [
"--no-verify",
"SKIP",
]
[]
[]
= [
"feat", # New feature
"fix", # Bug fix
"docs", # Documentation
"style", # Code style
"refactor", # Code refactor
"test", # Test related
"chore", # Maintenance
]
[]
= false
= [
"core",
"cli",
"ui",
"docs",
"test",
]
[]
= 1
= true # Forbid ending with a period
= 2 # Default min_length is 2
= 72 # Default max_length is 72
[]
= false
= 1
= true
= 2
= 72
[]
= ["BREAKING CHANGE", "Closes", "Fixes", "Signed-off-by"]
= 1
= 2
= 72
= true
Commit validation example:
Validation success Example:
Validation Failure Example:
(default config)
Uninstall
remove commit-msg hook from .git/hooks directory:
gitru uninstall commit-msg
remove .commit-msg-rule.toml file manually .