Skip to content

Instantly share code, notes, and snippets.

@jonathanstiansen
Forked from adymitruk/pre-receive
Created May 2, 2019 02:14
Show Gist options
  • Save jonathanstiansen/97003fa44d20bb2629b2c6d6038ab630 to your computer and use it in GitHub Desktop.
Save jonathanstiansen/97003fa44d20bb2629b2c6d6038ab630 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
# check if back merges are happening from important branches
echo "checking for bad branch names"
while read oldrev newrev refname; do
if [[ $oldrev == $zero_commit && ! $refname =~ ^refs/heads/[a-w]+$ ]]; then
echo "Blocking creation of new branch $refname because it must only contain lower-case alphabetical characters."
exit 1
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment