deerflow2/scripts/git/install-hooks.sh

17 lines
415 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$REPO_ROOT"
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "✗ Not inside a Git repository."
exit 1
fi
git config --local core.hooksPath .githooks
echo "✓ Git hooks installed"
echo " core.hooksPath = .githooks"
echo " pre-push will rebase the current branch before push"