Git · Middle · Question 10 of 75
Why prefer git push --force-with-lease over --force?
- ✓Correct answer: It refuses to overwrite remote commits you haven't seen
- 2It force-pushes only the tags, not the branches
- 3It pushes faster by compressing objects better
Explanation
--force replaces the remote branch blindly, wiping a colleague's new commits. --force-with-lease checks that the remote is still where your last fetch saw it.