stash is a shelf, not a storage unit
git stash takes your uncommitted work — both staged and unstaged — and puts it on a stack of "saved for later" snapshots, leaving the working tree clean. The use case is the interruption: you are mid-feature when an urgent bug needs a hotfix on main, and you cannot commit yet. Stash, switch, fix, switch back, pop. Five minutes. The interruption did not contaminate your half-done work.
The basic dance is short. git stash push -m "WIP feature/x" saves and clears the working tree. git stash list shows what is saved. git stash pop restores the most recent stash and removes it from the stack; git stash apply restores without removing, useful when you want to apply the same stash to multiple branches. git stash drop <ref> deletes a specific stash; git stash clear wipes all of them.
Two flags matter for daily use. -u (or --include-untracked): include new files Git does not track yet. Without this, untracked files stay in your working tree and might be missed when you switch branches. -k (or --keep-index): stash only the unstaged changes, keep the staged ones in place. Useful for committing the staged piece while shelving the rest.
Stash is a shelf, not storage. The stack survives across branches and stays around indefinitely, but it is local-only and easy to forget about. A stash from three months ago that no one remembers is dead weight, and conflicts can be hard to resolve when the codebase has moved on. The professional habit: stash for short interruptions (hours, not weeks), prefer commits on a WIP branch for anything you might come back to days later. git stash list at the start of a session catches stashes that should be turned into commits or dropped.