githook.sh

git hooks made easier. simple, lightweight, and portable.

like husky, but without npm.

docs · view · llms.txt

quick setup

curl -sSL https://githook.sh | sh

or with wget:

wget -qO- https://githook.sh | sh

this downloads .githook.sh to the current directory if not already, then runs install to setup hooks locally

manual setup

curl -sSL https://githook.sh -o .githook.sh
chmod +x .githook.sh
./.githook.sh install

commands

./.githook.sh install       set up git hooks (run once per clone)
./.githook.sh uninstall     remove git hooks configuration
./.githook.sh check         check for updates
./.githook.sh update        download latest version

adding hooks

create executable scripts in .githook/ named after the git hook:

echo '#!/bin/sh
npm test' > .githook/pre-commit
chmod +x .githook/pre-commit

scripts must be executable and start with a shebang.

environment variables

GITHOOK=0        skip hooks
GITHOOK_DEBUG=1  show debug output

migrating from husky

hooks are auto-migrated during setup if .husky/ is detected, or run manually:

./.githook.sh migrate husky

repository

github.com/elee1766/githook.sh

license

unlicense (public domain)