Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
use git hooks with templates

create and register git template directory

> mkdir -p ~/.git-templates/hooks
> git config --global init.templatedir '~/.git-templates'

add some example pre-push hook

> cat > ~/.git-templates/hooks/pre-push << EOF
#!/bin/bash
script='./utils/jslint.sh'
if [ -e \$script ]; then
  echo "running jslint"
  \$script
  exit \$?
fi
exit 0
EOF
chmod 755 ~/.git-templates/hooks/pre-push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.