Last active
November 22, 2022 10:29
-
-
Save Bazze/870fee0bb38ca0917b3cffa21063b04d to your computer and use it in GitHub Desktop.
Bash script for setting up symlinked git hooks (that works)
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 | |
# 1. Save this script in your repo as "hooks/setup.sh" | |
# 2. Save your git hooks in "hooks/git/<hook name>" | |
# 3. Execute this script with bash | |
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
cd "${DIR}/.." | |
# Symlink git hooks | |
for filename in ${DIR}/git/*; do | |
filename=$(basename ${filename}) | |
ln -s "../../hooks/git/${filename}" ".git/hooks/${filename}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment