Git stash twice

stephenmurdoch picture stephenmurdoch · Aug 5, 2013 · Viewed 40k times · Source

I had to quickly switch git branches, so I ran git stash, but I had to run it again because one of my files needed editing.

So I've run git stash twice, and I'm ready to go back to editing my files. I ran git stash apply but I'm not convinced that all of the files I had stashed were unstashed. Is there anything I can do? Any way to check?

When I run git stash show, I just see the last of my two git stashes.

Is there anyway to show all git stashes?

Answer

Felix Kling picture Felix Kling · Aug 5, 2013

You can get a list of all stashes with

git stash list

which will show you something like

stash@{0}: WIP on dev: 1f6f8bb Commit message A
stash@{1}: WIP on master: 50cf63b Commit message B

If you made two stashes, then just call git stash pop twice. As opposed to git stash apply, pop applies and removes the latest stash.

You can also reference a specific stash, e.g.

git stash show stash@{1}

or

git stash apply stash@{1}