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.
Search for a repository from the Command Bar (or go directly to its URL).
-
Click the "Admin tools" button at the top of the page.
-
Select Admin from the menu on the left side of the page.
-
Select Block or Block to the default branch under Push and Pull.
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.