https://github.com/captainhook-git/captainhook-bin
CaptainHook is a very flexible git hook manager for software developers that makes sharing git hooks with your team a breeze.
https://github.com/captainhook-git/captainhook-bin
automation code-quality git git-hooks hacktoberfest tool
Last synced: 30 days ago
JSON representation
CaptainHook is a very flexible git hook manager for software developers that makes sharing git hooks with your team a breeze.
- Host: GitHub
- URL: https://github.com/captainhook-git/captainhook-bin
- Owner: captainhook-git
- License: mit
- Created: 2023-10-27T12:18:33.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-08T12:47:29.000Z (5 months ago)
- Last Synced: 2025-06-09T13:11:31.914Z (5 months ago)
- Topics: automation, code-quality, git, git-hooks, hacktoberfest, tool
- Language: Go
- Homepage: http://captainhook.info
- Size: 1.25 MB
- Stars: 25
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README

[](https://packagist.org/packages/captainhook/captainhook)
[](https://goreportcard.com/report/github.com/captainhook-git/captainhook-bin)

[](https://pkg.go.dev/github.com/captainhook-git/captainhook-bin)
[](https://phpc.social/@captainhook)
# CaptainHook

*CaptainHook* is an easy to use and very flexible git hook manager for software developers.
It enables you to configure your git hook actions in a simple json file and easily share them within your team.
You can use *CaptainHook* to validate or prepare your commit messages, ensure code quality
or run unit tests before you commit or push changes to git. You can automatically clear
local caches or install the correct dependencies after pulling the latest changes.
You can run your own commands or use loads of built-in functionality.
For more information have a look at the [documentation](https://go.captainhook.info/ "CaptainHook Documentation").
## Installation
You can download the application binary for your platform from the [release page](https://github.com/captainhook-git/captainhook-bin/releases/latest "Latest CaptainHook Release").
Or use one of the following options.
Use `Homebrew` to install *CaptainHook*.
```bash
brew tap captainhook-git/captainhook
brew install captainhook
```
Use `go install` to install *CaptainHook*.
```bash
go install github.com/captainhook-git/captainhook-bin/cmd/captainhook@latest
```
## Setup
After installing CaptainHook, navigate to your project directory and use the *captainhook* init command to create a configuration file.
```bash
cd my-project-repo
captainhook init
```
As soon as you have a configuration file the only thing left is to activate the hooks by installing them to
your local `.git/hooks` directory. To do so just run the following *captainhook* command.
```bash
captainhook install
```
## Configuration
Here's an example *captainhook.json* configuration file.
```json
{
"hooks": {
"commit-msg": {
"actions": [
{
"run": "CaptainHook.Message.MustFollowBeamsRules"
}
]
},
"pre-commit": {
"actions": [
{
"run": "unittest"
}
]
},
"pre-push": {
"actions": [
{
"run": "CaptainHook.Branch.PreventPushOfFixupAndSquashCommits",
"options": {
"branches-to-protect": ["main", "integration"]
}
}
]
}
}
}
```
## Contributing
So you'd like to contribute to `CaptainHook`? Excellent! Thank you very much.
I can absolutely use your help.
Have a look at the [contribution guidelines](CONTRIBUTING.md).