You can block force pushes (git push --force) on all branches—or just the default branch—of a repository.

Each repository inherits a default setting from its owner (an organization or user account). You can override this default setting unless the repository's owner has chosen to enforce the setting on all of its repositories.

  1. Search for a repository from the Command Bar (or go directly to its URL).

  2. Click the "Admin tools" button at the top of the page.

    Admin Tools

  3. Select Admin from the menu on the left side of the page.

    Admin Tools

  4. Select Block or Block to the default branch under Push and Pull.

    Block force pushes

The change takes effect immediately. If you change your mind later, you can easily re-allow force pushes at the same location in the admin tools.

Further reading