Urgent bug, messy desk
You're halfway through a new menu design when the boss shouts: the phone number on the home page is wrong! Your changes aren't ready to commit. stash them, fix the bug, then pick up where you left off.
stash and pop
echo "<h1>Menu (new design)</h1>" > menu.html git status git stash git status echo "<h1>Himalayan Café</h1><p>Call 01-555</p>" > index.html git commit -am "Fix phone number" git stash pop cat menu.html
- git stash list shows the shelf; git stash -u includes untracked files too.
- Stashes are local and easy to forget — prefer a quick commit on a branch for anything longer than a few minutes.