Do you know about `git-sh-setup`? As in:
. "$(git --exec-path)/git-sh-setup"
require_clean_work_tree "bump" "Please commit or stash them."
https://git-scm.com/docs/git-sh-setup