git stash: save unfinished work for later

git stash takes your uncommitted changes, saves them on a shelf, and resets your files to the last commit. When you're ready, git stash pop puts the changes back, even on another branch.

Step by step

  1. Put your changes aside:

    $ git stash
  2. See what's on the shelf:

    $ git stash list
  3. Bring the latest stash back:

    $ git stash pop
  4. Or throw it away:

    $ git stash drop

Stash is perfect for interruptions: an urgent fix on main while you're halfway through a feature. New, untracked files aren't stashed unless you add -u.

Try it in the interactive sandbox →Practice “Stash it” with a real repository and teammates, right in your browser.

Related guides