Skip to content

Commit

Permalink
chore: add husky pre-push script
Browse files Browse the repository at this point in the history
  • Loading branch information
georgexu99 committed Nov 9, 2022
1 parent f3d38e0 commit 45e5077
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .husky/pre-push
@@ -0,0 +1,17 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

BRANCH=`git rev-parse --abbrev-ref HEAD`
PROTECTED_BRANCH="gxu-husky"

exec < /dev/tty

if [ "$BRANCH" = $PROTECTED_BRANCH ]; then
echo $BRANCH
read -p "[pre-push hook] Warning: this is a protected branch. Continue? (Y/n) " yn
case $yn in
[Yy]* ) exit 0;;
[Nn]* ) exit 1;;
* ) echo "Please answer y or n for yes or no."; exit 1;;
esac
fi

0 comments on commit 45e5077

Please sign in to comment.