Reject Force Push
This is the same as the per-repo hook that is in the base product. It is reproduced here as it allows system administrators to apply it at a level above project/repository administrator, such that they cannot disable it.
A force push is a push that rewrites history on the remote server, for instance squashing multiple commits into a single commit (such as is produced by a git rebase
). Generally, it’s desirable to squash commits on a feature branch so you have a clear and coherent history for your project… but only if the feature branch is not shared, or, it’s shared and you can ensure that the team has pushed any pending changes, and know how to reset from the rewritten branch.
Therefore you might want to combine this hook with conditions, such that you disable force pushing just to the default and release branches for instance, or allow only on feature branches.