hookman
v1.1.15
Published
Command line tool for tracking and distributing Githooks for your projects
Downloads
30
Readme
Hookman
Hookman is a Command Line Tool that helps your team manage and distribute commands and scripts used within your Git workflow.
Requirements
- Node 6.2.1
- A Git repository for your project
Installation
npm install -g hookman
Usage
Setting up hookman for your project
If your project is not already configured for use with hookman:
- Navigate to the root of your project and run
hookman init
- Add and commit
hooks/
directory andhookman.json
Installing project hooks to Git
If your project has a hooks/
directory and a hookman.json
file:
- Navigate to the root of your project and run
hookman install
Adding a hook scripts
In most cases hook scripts get the job done. Hooks scripts are similar
to npm scripts. They live in the hookman.json
file and are simple commands
that hookman will execute when git invokes a Githook.
- Open the
hookman.json
file in the root of your project. - Locate the hook you would like to target (
pre-commit
,pre-push
, etc.) - Write a command (just like you would in terminal) as the value for the hook
Example
{
...
"pre-commit": "npm run lint"
}
Adding hook executables
Hook executables are a big step up from hook scripts allowing your to write hooks for your project in any language. This allows you to harness existing code in your project as well as managed dependencies installed from your favorite package manager.
- From the root of your project run
hookman create
- Choose the hook you would like to target from the list provided.
- Locate the newly created file in your projects
hooks/
directory and start coding.