Skip to content

Instantly share code, notes, and snippets.

@DanielShterenberg
Last active September 24, 2021 07:49
Show Gist options
  • Save DanielShterenberg/5f9681cceb11c3afe508705b5fb41bfb to your computer and use it in GitHub Desktop.
Save DanielShterenberg/5f9681cceb11c3afe508705b5fb41bfb to your computer and use it in GitHub Desktop.
Creating a pre-push Git hook which will run multiple hooks.
#!/bin/bash
cd "$(dirname "$0")/pre-push.d"
for hook in *; do
bash $hook
RESULT=$?
if [ $RESULT != 0 ]; then
echo "pre-push.d/$hook returned non-zero: $RESULT, abort commit"
exit $RESULT
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment