volbrene-git-hooks
v1.9.3
Published
Git hook scripts with Conventional Commits enforcement
Maintainers
Readme
🔧 Volbrene – Git Hooks
Volbrene – Git Hooks helps you keep your commit messages consistent and enforce Conventional Commits automatically.
✨ Features
- ✅ Automatic ticket reference – parses branch names like
feature/IT-1234and prefixes commit messages. - ✅ Conventional Commits support – supports
feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert. - ✅ Fallback handling – unknown branch prefixes default to
chore(...). - ✅ Easy setup – installs hooks automatically via
npm install.
📦 Installation
Make sure you have Node.js (>=16) and npm installed, then run:
npm install --save-dev volbrene-git-hooksAfter that, initialize the hooks with:
npx volbrene-git-hooks initThis will add a prepare script to your package.json:
"scripts": {
"prepare": "volbrene-git-hooks"
}With this in place, the hooks will be automatically reinstalled whenever you (or your team) run npm install.
🔗 Available Hooks
The following Git hooks are installed in the hooks directory when the package is installed:
📝 prepare-commit-msg
This hook automatically rewrites commit messages based on your current branch name.
- If you are on
feature/IT-1234, and run:
git commit -m "add new button"It will rewrite the commit message to:
feat(IT-1234): add new buttonSupported branch prefixes:
| Branch Prefix | Resulting Commit Type |
| ---------------------------------------- | --------------------- |
| feature/*, feat/* | feat(...) |
| bug/*, bugfix/*, fix/*, hotfix/* | fix(...) |
| docs/* | docs(...) |
| style/* | style(...) |
| refactor/* | refactor(...) |
| perf/*, performance/* | perf(...) |
| test/*, tests/* | test(...) |
| build/* | build(...) |
| ci/* | ci(...) |
| revert/* | revert(...) |
| task/* or unknown | chore(...) |
⚙️ CLI Commands
install
Installs or re-installs the Git hooks for the current repository.
- Ensures
.git/hooksexists - Copies the
prepare-commit-msghook from this package into.git/hooks
reset-hooks
Resets Git’s core.hooksPath back to the default .git/hooks folder.
- Unsets any custom
core.hooksPath(e.g. from Husky or other tools) - Sets the local repository back to
.git/hooks - Prints the effective hook directory for verification
uninstall
Removes all installed Git hooks and unsets core.hooksPath.
- Deletes the
.git/hooksfolder (or the directory configured incore.hooksPath) - Attempts to unset
core.hooksPath(ignored if not set) - Useful for clean-up or before switching to another hook manager
init
Sets up automatic hook installation on npm install.
- Adds
"prepare": "volbrene-git-hooks"to yourpackage.jsonscripts - Ensures hooks will be installed for every developer after
npm install - Recommended for teams to keep hooks consistent
- Copies the
prepare-commit-msghook from this package into.git/hooks
help
Shows usage information and a list of available commands.
