From fd6cee0997135dfdc0c0edc15076ba9ce5c6aeab Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 12 Apr 2026 13:31:00 -0400 Subject: [PATCH] chore: Enhance git hook setup with executable permissions and submodule alias - Add chmod +x to ensure pre-push hook is executable after creation - Add global git alias 'sc-commit' for committing to all submodules at once - Improve user feedback with detailed explanation of installed components - Better code organization with clearer comments This makes the setup script more robust by ensuring the hook has proper permissions and provides a convenient command for bulk submodule commits. --- scripts/setup-git-hooks.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/setup-git-hooks.sh b/scripts/setup-git-hooks.sh index cd9ca02..1c587fa 100755 --- a/scripts/setup-git-hooks.sh +++ b/scripts/setup-git-hooks.sh @@ -1,8 +1,9 @@ #!/bin/bash # One-time setup for git hooks on this machine echo "🔒 Installing pre-push safety hook to prevent pushing with uncommitted submodule changes..." -# Create pre-push hook +# Create hooks directory mkdir -p .git/hooks +# Create pre-push hook cat >.git/hooks/pre-push <<'EOF' #!/bin/bash # Prevent pushing if submodules have uncommitted changes @@ -14,5 +15,10 @@ if [ -n "$uncommitted" ]; then exit 1 fi EOF - -echo "✅ Git hooks installed! Submodule changes will be checked before pushing." +# Make hook executable +chmod +x .git/hooks/pre-push +# Add git alias for submodule commit +git config --global alias.sc-commit '!sh -c "git submodule foreach \"git add -A && git commit -m \\\"$1\\\" && git push\"" -' +echo "✅ Git hooks and alias installed!" +echo " - Pre-push hook: Checks for uncommitted submodule changes" +echo " - Alias: 'git sc-commit' to commit and push all submodules"