As described in Git ProBook, “ Configuring Git - An Example of a Git-Energized Policy, ” such enforcement will be set via a hook, or rather, a server-side hook, such as update one:
All server-side work will go into the update file in your hooks directory. The update hook is launched once for each branch and takes three arguments:
- The name of the link that was clicked on
- The old version in which this thread was
- New revision clicked
This is preferable for hooks on the client side (liek a pre-commit one), which:
- must be installed manually by each user.
- can get around
The server-side key will apply any rule that you want for a specific repo by rejecting push git if your policy is not enforced.
Suppose you have control over the server of the remote repo server that your users click on.
If you do not, you will return to client-side clicks that can be installed using the Git template, the template directory of which can be shared by all users (starting with Git 2.9, June 2016) .
source share