Husky is a Git hook manager that allows you to configure and manage your hooks in a simple and efficient way. This package is written in Go and is compatible with all operating systems.
- Support for multiple hooks
- Simple installation and usage
- Compatible with all operating systems
go install github.com/vkunssec/husky@latest
To start using Husky in your project:
husky init
To force initialization in an existing project:
husky init --force
This command will:
- Configure the basic hook structure
- Prepare the Git environment
To add a new hook:
husky add <hook-name> '<comando>'
Example:
husky add pre-commit 'go test ./...'
See the examples folder for more examples of implemented hooks.
-
Commit Hooks
- pre-commit
- prepare-commit-msg
- commit-msg
- post-commit
- post-commit-msg
-
Merge Hooks
- pre-merge
- pre-merge-commit
- post-merge
- post-merge-commit
-
Rebase Hooks
- pre-rebase
- pre-rebase-commit
- post-rebase
- post-rebase-commit
-
Push Hooks
- pre-push
- update
-
Patch Hooks
- pre-applypatch
- post-applypatch
-
Others
- post-checkout
To install the configured hooks:
husky install
After initialization, Husky creates the following structure:
.
├── .git/
│ └── hooks/ # Git hooks (managed by Husky)
└── .husky/
└── hooks/ # Your custom hooks
Contributions are welcome! Please feel free to submit pull requests.