Some out-of-the-box hooks for pre-push.
See also: https://github.com/clumio-oss/pre-commit
Add this to your .pre-commit-config.yaml
- repo: https://github.com/clumio-code/pre-push-hooks
rev: v1.0.0 # use the release tag from github
hooks:
- id: check-branch-for-push
args: ['--pattern', '^testbranch.*']
...Protect specific branches from direct checkins.
-p/--patterncan be used to protect branches that match a supplied regex (e.g.--pattern, release/.*). May be specified multiple times.