Git hooks manager
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd adapt for npm Feb 15, 2019
context [skip travis] Add context Feb 8, 2019
spec adapt for npm Feb 15, 2019
.gitignore [skip travis] update Feb 14, 2019
.goreleaser.yml [skip travis] update Feb 14, 2019
.travis.yml add travis Feb 6, 2019
Gemfile add travis Feb 6, 2019
Gemfile.lock add travis Feb 6, 2019
LICENSE init Feb 5, 2019 [skip travis] update Feb 15, 2019
main.go add travis Feb 6, 2019

Build Status


Hookah it`s a simple manager of git hooks.

Sponsored by Evil Martians



Add Hookah to your system or build it from sources.


go get

npm and yarn

npm i @arkweid/hookah-js --save-dev
# or yarn:
yarn add -D @arkweid/hookah-js

# Now you can call it:
npx hookah -h

NOTE: if you install it this way you should call it with npx for all listed examples below.


sudo snap install --devmode hookah


brew install Arkweid/hookah/hookah

Or take it from binaries and install manualy


First time user

Go to your project directory and run:

hookah install

It add for you configuration file hookah.yml with default directories for hooks sources. Now we ready to add hooks! For example we want to add pre commit hooks. Lets do that:

hookah add pre-commit

It will add a hook .git/hooks/pre-commit. So every time when you run git commit this file will be executed. That directories also will be created .hookah and .hookah-local. Use first one for project/team hooks. Second one for you personal hooks. Add it to .gitignore

Next fill the directory .hookah/pre-commit with executables you like

│   └───pre-commit
│       ├─── fail_script
│       └─── ok_script


cat > .hookah/pre-commit/fail_script

exit 1

cat > .hookah/pre-commit/ok_script

exit 0

# Mark it as executables:
chmod +x -R .hookah

# Now we can commit:
git commit -am "It fail"

Done! Pretty simple, huh?

I want to run hook groups directly!

No problem, hookah have command for that:

hookah run pre-commit

# You will see the summary:
[ FAIL ] fail_script
[ OK ] ok_script

I want to use my own runner! And I dont want to change team/repository scripts.

Ok! For example you have any.go script. We can run it in this way:

Add hookah-local.yml

Add it to .gitignore. It your personal settings.

Next customize the any.go script:

    runner: "go"
    runner_args: "run"

Done! Now our script will be executed like this:

go run any.go

I clone the existed repo which use hookah. How can I setup hooks?

We suppose repo already have the hookah structure. So all of you need it run install:

hookah install

Hookah wiil read existed hook groups and reproduce hooks in .git/hooks directory.

How can I run my linter against only modified files?

No problem. Lets take rubocop linter for ruby as example:


git ls-files -m | xargs rubocop

I dont like bash. Give me working example for golang

Ok-ok! This is how any.go may looks like:

package main

import (

func main() {
  files, _ := context.StagedFiles()
  files = context.FilterByExt(files, ".rb")

  cmd := exec.Command("rubocop", strings.Join(files, " "))

  outputBytes, err := cmd.CombinedOutput()


  if err != nil {

We include context package only for convenience. It`s just few useful functions.