[ --force ] can cause the remote repository to lose commits; use it with care.

This is a snippet from the Git documentation on push --force . Seeing your work being blown into oblivion by an unsuspecting colleague is some of the least pleasant experiences you can have as a developer. It sucks. If you have been using push --force in your workflow you might see this risk as a necessary evil, but there is actually a way to make sure that it doesn’t happen to you or your colleagues: push --force-with-lease .

Git normally prevents you from rewriting history by making sure that the changes you push are aligned with what has already been pushed before. This means that your pushed commits must have a common past with the remote commits. --force is an option that allows you to bypass Git’s check for correct ancestry in the remote history. The end result of using --force or --force-with-lease is the same but the latter will ensure that your local reference of what is the latest remote commit is actually correct. It allows you to rewrite history, but prevents you from accidentally removing history by keeping the ancestry check.

As the Git documentation says “If somebody else built on top of your original history while you are rebasing, the tip of the branch at the remote may advance with her commit”. By blindly —-force pushing your work you would replace someone else’s. With --force-with-lease , you won’t.