Happy Friday! Happy Thanksgiving!
$ cat .git/hooks/pre-commit
#!/bin/bash
branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$branch" == "master" || "$branch" == "develop" || "$branch" == *-stable ]]; then
echo "You can't commit directly to master/stable/develop branch"
exit 1
fi
You are welcome.