Start here if…
You need to temporarily save uncommitted changes without committing them (for example, to switch branches or pull upstream changes) and want to learn git stash, git stash apply, and git stash pop.
git stash saves your uncommitted changes and resets your working directory to the last commit, so you can switch branches or pull without committing half-finished work. To get your changes back, run git stash pop, which applies the stash and deletes it, or git stash apply, which applies it and keeps it.
Stashes are easy to lose track of in the terminal. GitKraken Desktop shows every stash in the commit graph, so you always know where your work went.
Normally, when you edit, add, or delete a file in your Git repository, you would stage and then commit those changes.
GitTip: Not sure how to commit in Git? Check out our quick tutorial video before you get started with stashing.
But let’s say you’re in a situation where you’re in the middle of working on changes and are interrupted by a request to checkout a different branch, maybe to help a colleague, but you’re not ready to commit your changes.
Or, maybe you discover you have the wrong branch checked out and the changes you’re working on actually need to be committed to another branch.
That’s what git stash is for. It saves your uncommitted changes so you can work on something else without losing them. When you’re ready, apply or pop the stash onto whichever branch you have checked out.
What is Git stash apply?
git stash apply copies the changes from a stash into your working directory and keeps the stash in your stash list. Use it when you might need the same changes again, like applying them to more than one branch.
What is Git stash pop?
git stash pop applies the changes from a stash and then deletes it from your stash list. If the pop causes a merge conflict, Git keeps the stash so you don’t lose anything. After you resolve the conflict, delete the stash yourself with git stash drop.
How do you stash changes in Git?
Stash when you need a clean working directory for a few minutes, such as switching branches, pulling upstream changes, or testing something on main. Stashes are meant to be short-lived. If you’re juggling several stashes, a commit on a separate branch or a Git worktree is easier to keep track of.
We’re going to walk through how to stash changes using the powerful GitKraken Git GUI before reviewing how to Git stash in the command line.
See every stash in your commit graph. Download GitKraken Desktop for Windows, Mac, and Linux.
How do you stash changes with GitKraken?
In this example, let’s say you have a feature branch checked out and are going to make a few edits to a file. But wait! You’ve just realized you meant to commit these changes on a different branch.
Before you stash your changes, let’s first type a name into the WIP node. Now, when you click the Stash icon in the top toolbar, GitKraken will stash your changes with the name you’ve set.
Viewing Your Git Stashes in GitKraken
GitKraken’s UI was thoughtfully designed to provide as much visibility as possible, so you can clearly see what’s going on in your repositories. Tracking your stashed changes in GitKraken is easy and convenient; stashes are denoted with a icon so you can immediately distinguish them on your graph.
Clicking on the stash icon from the graph will allow you to see its saved contents in the commit panel on the right.

You can also quickly see a list of your stashes in the left panel.

How do you Git stash apply with GitKraken?
If you wish to apply your stashed changes but keep the stash intact, you can right-click the stash from the central graph in GitKraken and select Apply Stash from the context menu.
How do you Git stash pop with GitKraken?
To pop your stashed changes in GitKraken, you will double-click your target branch—where you want your changes applied—to checkout that branch. Then you will simply hit Pop in the top toolbar. This will apply your stashed changes onto the correct branch and delete your stash. And from here, you can move forward with committing your changes.
Stash changes with less risk with GitKraken’s superior visual context.
How do you Git stash in the command line?
To stash uncommitted local changes in Git using the terminal, you will simply run the Git stash command. This will put your working copy in a clean state and allow you to run different commands, such as Git checkout or Git pull.
If you wish to see the contents of your most recent stash, you can run:
git stash show
Git Stash List
But, what if you wanted to view the contents of an older stash? To do this, you will first have to run:
git stash list
The Git stash list command will pull up a list of your repository’s stashes. Git will display all of your stashes and a corresponding stash index.
Now, if you wish to view the contents of a specific stash, you can run the Git stash show command followed by stash@ and the desired index.
git stash show stash@<index>
For the remainder of this article, we’re going to assume you’re working with your most recent stash, but you can always utilize this syntax with other Git stash commands as needed.
In this Git stash example, let’s say you stashed changes and then went on to finish other tasks in your repository. Now, how do you go about getting those stashed changes back? There are two paths to choose from to get your stashed changes back into your working repository.
How do you Git stash apply in the command line?
If you want to get your stashed changes back but want to keep the stash intact, you will use the Git stash apply command. This will take the changes of your most recent stash and apply them to your repository and preserve the stash.
git stash apply
How do you Git stash pop in the command line?
In the case that you wish to get your stashed changes back but do not want to keep your stash intact, you will instead use the Git stash pop command. Similar to Git stash apply, Git stash pop will apply your most recent stash to your repository but will remove the contents of the latest stash for you afterwards.
git stash pop
Ready for a cleaner way to Git stash?
GitKraken’s intuitive UI makes tracking the stashes in your repository ridiculously easy by denoting each stash with an icon in the central graph, no need to find or remember stash indexes.
Never lose track of stashed changes again. Download the legendary cross-platform GitKraken Git client for Windows, Mac, & Linux
GitKraken MCP
GitKraken Insights