When pushing a commit, this custom pre-hook checks the files being pushed against a server side .gitignore template.
If any of the files match those specified in the .gitignore template, the push is rejected.
Binaries increase repo size, which swells disk space consumption and enlarges git clone time locally and in other
systems such as on a CI/CD server. Destroying files and associated history in Git is not easy and discouraged, so
binaries should be rejected from the outset.
Good to Know
With this custom pre-hook, ScriptRunner for Bitbucket rejects the push with a custom error message.