Skip to content

Instantly share code, notes, and snippets.

@bowmanmike
Last active October 28, 2020 20:52
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 bowmanmike/e2fd2b8ad7a82038dd4e4c5a74bc83d2 to your computer and use it in GitHub Desktop.
Save bowmanmike/e2fd2b8ad7a82038dd4e4c5a74bc83d2 to your computer and use it in GitHub Desktop.
Print confirmation before pushing to master
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