Created
August 3, 2017 06:18
-
-
Save hikoma/13d8806ea9d455cf6d5afc84877c87a2 to your computer and use it in GitHub Desktop.
Git pre-push hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
while read local_ref local_sha1 remote_ref remote_sha1 | |
do | |
if [[ "${remote_ref##refs/heads/}" =~ (master|develop) ]]; then | |
exec < /dev/tty | |
read -p "Push to ${remote_ref##refs/heads/}? [Y/n] " answer | |
if [[ "${answer}" =~ ^[Yy] ]]; then | |
exit | |
fi | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment