Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 27 lines (24 sloc) 528 Bytes
#!/usr/bin/env bash
###
#
# Updates hooks from template directory
# to the current git repo
#
set -e
case "$1" in
update)
if [ ! -d $PWD/.git/ ]; then
echo "Currently not in a git repository"
exit 1
fi
# Could this be rsynced instead?
FILES=$(git config --path --get init.templatedir)/hooks/*
for FILE in $FILES
do
cp -Rv $FILE $PWD/.git/hooks/
done
;;
*)
echo $"Usage: git hooks {update}"
exit 1
esac