git push --force overwrites the remote unconditionally — including any commits a collaborator pushed since you last fetched. Don't use it.
git push --force-with-lease is the safer alternative: it only force-pushes if the remote is in the state you expected (i.e., you've fetched recently and nothing new has landed).
If a collaborator pushed in between, --force-with-lease aborts with a message — preventing data loss.
When you must force-push:
git push --force-with-lease
Pair with a workflow:
git fetch origin
git rebase origin/main (or whatever rewriting you do)
git push --force-with-lease
Configure it as the default for safety:
git config --global push.force-if-includes true