Some people love using Git's force push feature. Some people don't. And even among those who do, some people really really don't want agents like Claude Code running force push.
The following Git hook lets you disable force push on your computer. It can be disabled by setting ALLOW_GIT_FORCE_PUSH=I_AM_A_HUMAN_NOT_AN_LLM_AND_I_THE_HUMAN_WANT_TO_FORCE_PUSH, which hopefully your LLM will avoid doing. (It can also be skipped with a particular git flag, but hopefully your agent will avoid that too.)
This is local to your computer: it is not shared with your collaborators. (A more effective way to prevent force push is to configure your Git server to not allow force pushes, such as via GitHub rule sets.)
There are two ways to set this up: