Skip to content

Instantly share code, notes, and snippets.

@ironbyte
Forked from SimonHoiberg/prepush-hook
Created July 27, 2020 07:28
Show Gist options
  • Save ironbyte/c8798a50544546945f67de65f91b650d to your computer and use it in GitHub Desktop.
Save ironbyte/c8798a50544546945f67de65f91b650d to your computer and use it in GitHub Desktop.
#!/bin/sh
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ 'master' = ${current_branch} ]
then
echo "ERROR: Not allowed to push to master."
exit 1;
else
exit 0;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment