Gitflow
🎯Pushed to the Wrong RemoteMedium+500 XP
Workshop
Scenario reference

Pushed to the Wrong Remote: the situation, step by step

The situation

You have `origin` (the fork) and `upstream` (the canonical repo). You meant to push to origin, but typed `git push upstream feature` — and upstream branch protection wasn't on.

Delete the remote branch you pushed by mistake, then push to the correct remote.

Medium · 3 steps · +500 XP

What you will practice

This scenario walks through 3 steps, in order:

  1. 01List remotes to confirm
  2. 02Delete the branch you accidentally pushed to upstream
  3. 03Push to the right remote
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. List remotes to confirm
    git remote -v
  2. 2. Delete the branch you accidentally pushed to upstream
    git push upstream --delete feature-x
  3. 3. Push to the right remote
    git push -u origin feature-x

Key takeaway

Always check `git remote -v` before pushing to unfamiliar setups.