We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

What Is the Stash

The git stash command stores your changes in a stack (LIFO) data structure. That means that when you retrieve your changes from the stash, you'll always get the most recent changes first.

# 'git stash' pushes a change onto the stash
git stash
# 'git stash pop' pops a change off the stash
# and applies it to the working directory
git stash pop

Click to play video

A "stash" is a collection of changes that you've not yet committed. They might just be "raw" working directory changes, or they might be staged changes. Both can be stashed. So, for example, you can:

  1. Make some changes to your working directory
  2. Stage those changes
  3. Make some more changes without staging them
  4. Stash all of that

When you do, the "stash entry" will contain both the staged and unstaged changes and both your working directory and index will be reverted to the state of the last commit. It's a very convenient way to "pause" your work and come back to it later.