foundation

Stash

Temporarily save uncommitted work while switching context, then reapply or discard it deliberately.

Stash saves uncommitted changes (and optionally untracked files) outside the current branch so you can switch context. Entries live on a stack — not a durable work-tracking system.

					git stash push -m "wip login form"
git stash push -u          # include untracked
git stash list
git stash pop              # apply and remove top entry
git stash apply stash@{2}
				

Use for short interruptions: urgent hotfix, review someone else's branch, quick experiment. For work that needs review or spans days, prefer a WIP branch.

On interviews: stashing tracked vs untracked, apply vs pop, naming stashes, and avoiding forgotten hidden work.

Common pitfalls: large stash stacks become invisible debt; stashing before pull then losing track of what was stashed; relying on stash instead of atomic commits.

The trade-off is convenience for context switches versus visibility and reviewability of real branches.

Checklist:

  • Use stash for short interruptions only.
  • Name stashes when more than one may exist.
  • Clear stale stashes deliberately.
  • Prefer WIP branches for meaningful partial work.