Skip to content

Instantly share code, notes, and snippets.

@cathyxz
Last active January 24, 2017 07:49
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 cathyxz/f1e51f55be4e21ee16e2396ef4c0fc6a to your computer and use it in GitHub Desktop.
Save cathyxz/f1e51f55be4e21ee16e2396ef4c0fc6a to your computer and use it in GitHub Desktop.
verify release merge
#!/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