DEV Community

Discussion on: What are Git Hooks?

Collapse
 
vlasales profile image
Vlastimil Pospichal

pre-push from the video (modified):

#!/bin/sh

ref=$(git symbolic-ref HEAD)
if [ "${ref#*/*/}" = 'master' ]; then
    echo "ERROR: Not alowed to push to master" >&2
    exit 1
fi