git push --force-with-lease

Category: Git - Core

git push --force-with-lease

Force push safely — fails if remote has new commits

Force-pushes (overwrites remote history) but safely — it fails if someone else has pushed since your last fetch.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.