Gitflow
🪓Delete an Accidentally Pushed BranchEasy+300 XP
Workshop
Scenario reference

Delete an Accidentally Pushed Branch: the situation, step by step

The situation

You pushed `local-test-stuff` to origin while debugging. It's cluttering the branch list — and contains a half-typed password in commit messages.

git push origin --delete <branch> removes the remote ref.

Easy · 2 steps · +300 XP

What you will practice

This scenario walks through 2 steps, in order:

  1. 01Delete the local branch
  2. 02Delete the remote branch
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. Delete the local branch
    git branch -D local-test-stuff
  2. 2. Delete the remote branch
    git push origin --delete local-test-stuff

Key takeaway

--delete (or the legacy `:branch` syntax) drops remote branches.