Last active
January 24, 2017 07:49
-
-
Save cathyxz/f1e51f55be4e21ee16e2396ef4c0fc6a to your computer and use it in GitHub Desktop.
verify release merge
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/sh | |
# Pre-merge hook that lists all commits and asks you if you really want to | |
# merge them in. For release branches only. | |
case $2 in | |
merge) | |
branch=$(grep -o "release/[0-9]\.[0-9]" $1) | |
if [[ ! -z $branch ]] | |
then | |
echo "Merging the following commits from branch $branch:" | |
git log ..$branch | |
exec < /dev/tty | |
while true; do | |
read -p "Are you sure you want to merge? (Y/n) " yn | |
if [ "$yn" = "" ]; then | |
yn='Y' | |
fi | |
case $yn in | |
[Yy] ) exit;; | |
[Nn] ) exit 1;; | |
* ) echo "Please answer y or n for yes or no.";; | |
esac | |
done | |
exec <&- | |
fi | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment