Git 2 · Remotes
Force push safely
Overwrite the remote branch only if nobody has pushed to it since you last fetched.
git push --force-with-lease
Caution: Force pushing replaces remote history. Never do it on a shared branch such as main.
Git 2 · Remotes
Overwrite the remote branch only if nobody has pushed to it since you last fetched.
git push --force-with-lease
Caution: Force pushing replaces remote history. Never do it on a shared branch such as main.
Was this page helpful?