Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clears out current git hooks and runs 'git init' to apply hooks that are in .git-templates/hooks
#!/usr/bin/env bash
# Check that the git directory exists.
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$GIT_DIR" ]; then
echo >&2 "Fatal: GIT_DIR not set"
exit 1
fi
# Remove existing hooks and re-init to copy new hooks.
rm $GIT_DIR/hooks/*
git init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment