Skip to content

Instantly share code, notes, and snippets.

@bdlangton
Created September 22, 2016 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdlangton/a03686bbe0387f5b2539350bd3a3c453 to your computer and use it in GitHub Desktop.
Save bdlangton/a03686bbe0387f5b2539350bd3a3c453 to your computer and use it in GitHub Desktop.
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