github.com/jbking/gohan@v0.0.0-20151217002006-b41ccf1c2a96/hooks/pre-push (about)

     1  #!/bin/bash
     2  
     3  BRANCH=$(git rev-parse --abbrev-ref HEAD)
     4  PUSH_COMMAND=$(ps -ocommand= -p $PPID)
     5  
     6  if [[ $BRANCH =~ master|development && $PUSH_COMMAND =~ force|delete|-f ]]; then
     7    echo "Prevented force-push to $BRANCH. This is deprecated as it will overwrite"
     8    echo "the history of commits that other developers have already downloaded."
     9    echo "Try to use it only on your own branches."
    10    echo "If you really have to do this, use --no-verify to bypass this pre-push hook."
    11    exit 1
    12  elif [[ $BRANCH =~ master|development ]]; then
    13    read -p "Are you sure you want to Push to $BRANCH?(y/n)" -n 1 < /dev/tty
    14    if [[ ! $REPLY =~ y|Y ]]; then
    15      echo
    16      exit 1
    17    fi
    18  fi
    19  
    20  #Do not delete this line
    21  ./hooks/run_local_hook.sh $@