force push

A push that makes the remote branch match yours even when that throws away commits the remote has.

It overwrites commits other people pushed to the branch.

In more detail

It is needed after rewriting history you had already pushed, and it silently deletes anyone else's work that was pushed in the meantime. Prefer --force-with-lease, and never force-push a shared branch others build on.

Example

git push --force origin main

Related terms

Taught in

References

Certification courses