Stash uncommitted changes and restore them later with git stash

domain: git-scm.com/git · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Save all current local modifications away with git stash (equivalent to git stash push). The working directory is reverted to match HEAD.
  2. Include untracked files with git stash -u (--include-untracked), or ignored files too with git stash -a (--all).
  3. List saved stashes with git stash list; the most recent is stash@{0}.
  4. Inspect a stash before applying it: git stash show stash@{1}, or with the full patch git stash show -p stash@{0}.
  5. Restore the most recent stash and remove it: git stash pop. To restore without removing it: git stash apply.
  6. Apply a specific stash: git stash pop stash@{2} or git stash apply stash@{1}.
  7. Drop a stash you no longer need: git stash drop stash@{0}; clear all stashes with git stash clear.

Known gotchas

Related routes

Restore or discard changes to working-tree files with git restore
git-scm.com/git · 6 steps · unrated
Undo commits with git reset (soft, mixed, and hard)
git-scm.com/git · 6 steps · unrated

Give your agent this knowledge — and 16,900+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans