Gitflow
📦Stash Untracked Files TooEasy+300 XP
Workshop
Scenario reference

Stash Untracked Files Too: the situation, step by step

The situation

You ran `git stash` to switch branches, but your new untracked `migration.sql` was left behind — and you accidentally committed it on the wrong branch.

`git stash` ignores untracked by default. Use -u (or -a for ignored too).

Easy · 3 steps · +300 XP

What you will practice

This scenario walks through 3 steps, in order:

  1. 01Stash everything including untracked
  2. 02Confirm clean
  3. 03Pop the stash on the right 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. Stash everything including untracked
    git stash -u
  2. 2. Confirm clean
    git status
  3. 3. Pop the stash on the right branch
    git stash pop

Key takeaway

`git stash -u` includes untracked. `-a` also includes ignored files.