What is the difference between force push and force with lease in Git?
Both replace the remote branch with your local branch. The difference is the safety check.
–force
–force-with-lease
Overwrites the remote branch in any case
Overwrites only if the remote branch is what you last fetched
Can delete commits pushed by your teammates
Fails if someone else pushed new commits meanwhile
Risky
Much safer
Use force push only on your own feature branches after you rewrote the history (rebase or amend), and prefer --force-with-lease. Never force push to main. See Git Push.