Skip to content

Instantly share code, notes, and snippets.

@masuidrive
Created December 24, 2014 07:23
Show Gist options
  • Save masuidrive/cc01ea0507dd19abfc05 to your computer and use it in GitHub Desktop.
Save masuidrive/cc01ea0507dd19abfc05 to your computer and use it in GitHub Desktop.
developへpushする場合には警告するスクリプト
#!/bin/bash
protected_branch='develop'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push $protected_branch, is that what you intended? [y/N] " -n 1 -r < /dev/tty
echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
then
exit 0 # push will execute
fi
exit 1 # push will not execute
else
exit 0 # push will execute
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment