git stash

Temporarily save and restore uncommitted work.

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

git stash saves your working directory changes and index to a stack, letting you switch contexts cleanly and restore later. Supports multiple stashes, partial stashing with -p, and stashing untracked files with -u.

Common flags
FlagMeaning
push -mStash with a descriptive message
popApply most recent stash and remove it
applyApply stash without removing it
listShow all stashes
dropDelete a specific stash
-uInclude untracked files
-pInteractively choose hunks to stash
Examples
git stash push -m 'WIP: refactor auth module'Stash with descriptive message · explain & risk-check →
git stash listView all stashes · explain & risk-check →
git stash popRestore most recent stash · explain & risk-check →
git stash show -p stash@{1}View diff of second stash · explain & risk-check →
Pro tip

Use `git stash push -u -m 'description'` to include untracked files — otherwise new files you've created stay in the working tree and may contaminate the branch you switch to.

Related
git log git rebase git
Open the full explainer →More in Git

Reference text is hand-written and may be incomplete — check man git for your version. Test destructive commands on a non-production system first.