Created
November 13, 2013 00:03
-
-
Save danott/7441071 to your computer and use it in GitHub Desktop.
Gate frivolous commits to master and staging.
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
#!/bin/bash | |
exec < /dev/tty | |
current_branch() { | |
git rev-parse --abbrev-ref HEAD | |
} | |
if current_branch | grep -E "^(staging|master)$" > /dev/null | |
then | |
read -p "Are you sure you want to commit changes to $(current_branch)? [yn] " -n 1 -r | |
if [[ ! $REPLY =~ ^[Yy]$ ]] | |
then | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment