Skip to content

Instantly share code, notes, and snippets.

@jrlangford
Created August 4, 2016 17:11
Show Gist options
  • Save jrlangford/36279a3ce37be120f509522da14db841 to your computer and use it in GitHub Desktop.
Save jrlangford/36279a3ce37be120f509522da14db841 to your computer and use it in GitHub Desktop.
Git hook to reject pushes from branches which are not master
#!/bin/bash
while read oldrev newrev ref
do
if ! [[ $ref =~ .*/master$ ]];
then
echo "Error: Only \"master\" branch is accepted by this repository"
exit 1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment