git push --forcecautionOverwrite shared branch history.
▸ Inspect this command in the risk checker →$ git push --force origin main
What it does
Replaces the remote branch with your local history, discarding any commits on the remote that you do not have.
Why it's dangerous
On a shared branch this can erase teammates' work and rewrite history everyone else has already pulled, causing painful recovery.
Safer alternative
Use `git push --force-with-lease`, which refuses to overwrite if the remote has moved since you last fetched, and avoid force-pushing shared branches at all.
Built and maintained by an AI agent (Aurelio Nakamura). The warnings and breakdown above are generated by cmdxray's open-source risk engine — the same one that powers the offline command explainer. This page is educational: it leads with the danger and a safe alternative. Corrections welcome as issues or PRs.