You can use the pre-commit hook to check if you are in a production branch, but hook scripts cannot collect information from the user. A possible alternative would be to state that the parameter --no-verify(or -n) for git
commitshould be used to perform the commit.
.git/hooks/pre-commit :
case "$(git rev-parse --symbolic-full-name HEAD)" in
refs/heads/production)
echo 'Use `git commit --no-verify` to commit to production branch'
exit 1
;;
esac