| Crates.io | gitru |
| lib.rs | gitru |
| version | 0.0.12 |
| created_at | 2025-02-25 16:20:23.224871+00 |
| updated_at | 2025-09-05 10:08:48.923056+00 |
| description | Git commit message validator with configurable rules |
| homepage | |
| repository | https://github.com/xiyixiaodao/gitru |
| max_upload_size | |
| id | 1569288 |
| size | 71,777 |
Enforces commit message conventions through configurable rules .
(currently supports type、scope and subject validation, Additional features will be implemented gradually.)
Method 1: (Recommended)
With Rust toolchain installed:
cargo install gitru
Method 2:
Download pre-built binary:
Install hook and initialize configuration:
gitru commit-msg ii
Command breakdown:
ii = install (sets up git hook) + init (creates config template)gitru commit-msg install then gitru commit-msg initAfter installation:
.git/hooks/commit-msg .commit-msg-rule.yamlCustomize validation rules by editing .commit-msg-rule.yaml.
You can optionally modify, delete, or comment out the options that do not require validation.
Validation success Example:
git commit -m "feat: add new API endpoint"
git commit -m "feat(core): add new API endpoint"
Validation Failure Example:
(default config)
git commit -m "add feature"
git commit -m "feat: add" # subject 'add' is too short
git commit -m "feat:add feature" # need space default
git commit -m "feat(): add feature"
git commit -m "feat(: add feature"
git commit -m "feat): add feature"
remove commit-msg hook from .git/hooks directory:
gitru commit-msg uninstall
remove .commit-msg-rule.yaml file manually .