Gitflow
🚚Stash Is on the Wrong BranchMedium+500 XP
Workshop
Scenario reference

Stash Is on the Wrong Branch: the situation, step by step

The situation

You stashed WIP while on `main`. It was actually feature work. You want it on a new branch instead.

`git stash branch <name>` creates a branch from the stash's parent and applies it.

Medium · 2 steps · +500 XP

What you will practice

This scenario walks through 2 steps, in order:

  1. 01Confirm the stash exists
  2. 02Create a new branch from the stash
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. Confirm the stash exists
    git stash list
  2. 2. Create a new branch from the stash
    git stash branch feature/from-stash

Key takeaway

`stash branch` is the cleanest way to recover from a misplaced stash.