Skip to content

How to use stash well

Use stash for short context switches, name your stashes, include untracked files when needed, and clean up often.

Stash without regret

  1. Name your stashes

    git stash push -m "wip: fix login" beats WIP on main: <hash>. You will not remember which is which.

  2. Include untracked with `-u`

    git stash -u saves new files too. Without it, a new file is left behind and lost on next git clean -fd.

  3. Prefer `pop` over `apply`

    pop deletes from the stack; apply does not. apply accumulates duplicated stashes you never clean.

  4. Drop old stashes

    git stash clear wipes all. Review with git stash list first.

  5. Prefer worktrees for long work

    If you switch contexts for hours, use git worktree add instead of a long-lived stash.