CmdWiz

7 Streak
Back to vault
Version Control

Force Push with Lease

git push --force-with-lease

Functional Description

Force-updates the remote branch only if no one else has pushed to it since you last fetched.

CategoryGit
Difficultyintermediate

Execution Recipes

Safer Force Push
git push --force-with-lease origin main

Refuses to overwrite the remote if it advanced beyond your local view.

Official Documentation

View the technical reference