Skip to content

Instantly share code, notes, and snippets.

@jtbonhomme
Created March 25, 2021 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtbonhomme/8bc3e05ef4dc1d5ff038518d6e342ecb to your computer and use it in GitHub Desktop.
Save jtbonhomme/8bc3e05ef4dc1d5ff038518d6e342ecb to your computer and use it in GitHub Desktop.
This git hook prevents to push on remote any branch which matches with a regex (`DO-NOT-PUSH.*`)
# Save this into .git/hooks/pre-push, then chmod +x .git/hooks/pre-push
if [[ `grep 'DO-NOT-PUSH.*'` ]]; then
echo "You really don't want to push this branch. Aborting."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment