Skip to content

Instantly share code, notes, and snippets.

@lapis-zero09
Created May 11, 2018 07:19
Show Gist options
  • Save lapis-zero09/492ecccd528be814fac480160c593a2d to your computer and use it in GitHub Desktop.
Save lapis-zero09/492ecccd528be814fac480160c593a2d to your computer and use it in GitHub Desktop.
#!/bin/bash
while read local_ref local_sha1 remote_ref remote_sha1
do
if [[ "${remote_ref##refs/heads/}" = "origin/master" ]]; then
echo -n "Do you want to push to ${remote_ref} ${remote_sha1}? (y/n) : "
exec < /dev/tty
read answer
case $answer in
y)
echo "push to origin/master"
break;
;;
n)
echo "stopping push"
exit 1
;;
*)
echo "stopping push"
exit 1
;;
esac
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment