Last active
October 28, 2020 20:52
-
-
Save bowmanmike/e2fd2b8ad7a82038dd4e4c5a74bc83d2 to your computer and use it in GitHub Desktop.
Print confirmation before pushing to master
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
branch="$(git branch --show-current)" | |
if [ $branch = "master" ]; then | |
echo "WARNING!!!" | |
echo "You're currently pushing directly to master!" | |
echo "" | |
read -p "Are you sure? Type 'yes' to confirm: " answer | |
if [ $answer = "yes" ]; then | |
echo "Pushing..." | |
exit 0 | |
else | |
echo "Aborting!" | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment