Skip to content

Instantly share code, notes, and snippets.

@fujimura
Created November 21, 2016 05:54
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 fujimura/9459e2c1fa0384a8a066dd6b38f175fd to your computer and use it in GitHub Desktop.
Save fujimura/9459e2c1fa0384a8a066dd6b38f175fd to your computer and use it in GitHub Desktop.
pre-push hook to prevent push to master branch
#!/bin/bash
# Taken from http://thinca.hatenablog.com/entry/20150306/1425639218
while read local_ref local_sha1 remote_ref remote_sha1
do
if [[ "${remote_ref##refs/heads/}" = "master" ]]; then
echo "Do not push to master branch!!!"
exit 1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment