Created
January 12, 2021 19:37
-
-
Save chrispruitt/5dde5711e595ad386a3c0f098766dc6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This file is to be run at the root of a git repo. | |
# It simply symlinks any .sh files in a .githooks/ directory to the .git/hooks directory, | |
# effectively installing your versioned git hooks. | |
# create .git/hooks directory if not exists | |
( | |
cd .git || exit 1 | |
mkdir -p hooks | |
) | |
for hook in .githooks/*.sh | |
do | |
name=${hook/hooks/\/hooks} | |
name=${name/\.sh/} | |
echo "linking ${hook} -> ${name}" | |
ln -s ${hook} ${name} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment