Gitflow
🛡️Force-Push Without Stomping TeammateMedium+500 XP
Workshop
Scenario reference

Force-Push Without Stomping Teammate: the situation, step by step

The situation

You rebased your shared `feature/auth` branch. About to push — but a teammate may have pushed to it 5 minutes ago.

--force-with-lease aborts if remote moved unexpectedly. --force never does.

Medium · 2 steps · +500 XP

What you will practice

This scenario walks through 2 steps, in order:

  1. 01Fetch first to refresh refs
  2. 02Force-push with the safety lease
Reveal the step-by-step commands

Try the terminal first — you learn more by doing. When you want to check yourself, here is the command for each step.

  1. 1. Fetch first to refresh refs
    git fetch
  2. 2. Force-push with the safety lease
    git push --force-with-lease

Key takeaway

Always prefer --force-with-lease. It saves teammates' work.