Skip to content

Instantly share code, notes, and snippets.

Last active November 22, 2022 10:29
What would you like to do?
Bash script for setting up symlinked git hooks (that works)
#!/usr/bin/env bash
# 1. Save this script in your repo as "hooks/"
# 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}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment