Skip to content

Instantly share code, notes, and snippets.

@sandfox
Created February 12, 2018 11:48
Show Gist options
  • Save sandfox/10bcd8286f46f253201ae8bd151a2d95 to your computer and use it in GitHub Desktop.
Save sandfox/10bcd8286f46f253201ae8bd151a2d95 to your computer and use it in GitHub Desktop.
delete all hooks from a git repo
#! /usr/bin/env bash
set -e
shopt -s extglob
HOOKDIR="$(git rev-parse --git-dir)/hooks"
if [ -d "$HOOKDIR" ]; then
rm -rf "${HOOKDIR:?}"/!(*.sample)
echo "all hooks removed from $HOOKDIR"
else
echo "no git hooks folder found, you probably aren't in a git repo"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment