Inspired from the husky-go
go install github.com/plvhx/polar@latest
You can initialize polar by typing polar init
Make sure you have git initialized.
This will make the .polar directory with the hooks folder. You can add hooks using:
$ polar add <hook> "
<your commands for that hook>
"
$ polar add pre-commit "
go build -v ./...
go test -v ./...
"
Checking commit message before committed (based on git-karma). But first, you must write your own acceptable commit types in
.polar-commitmsg-types.yaml
. You can see example configuration format below:
types:
- feat
- fix
- perf
- docs
- style
- refactor
- test
- build
- defect
- foobar
- aabbcc
Then, activate the hook:
$ polar activate-commit-validator
And you're set. Everytime you run git commit
it will validates that commit message you recently supplied.
Learn more about git hooks from these useful resources:
BSD-3-Clause