DEV Community

Cover image for How to pop out a specific stash from the stash list in Git?
MELVIN GEORGE
MELVIN GEORGE

Posted on • Originally published at melvingeorge.me

How to pop out a specific stash from the stash list in Git?

Originally posted here!

To pop a specific stash in git, you can use the git stash apply command followed by the stash@{NUMBER} command.

# Get or pop out a specific stash in Git
# "n" refers to the number in the list
git stash apply stash@{n}
Enter fullscreen mode Exit fullscreen mode

For example, to list out all the stashes you have saved into the git stash you can use the,

git stash list
Enter fullscreen mode Exit fullscreen mode

command.

It will show the list of stashes you have saved.

Then you can see something like this in the terminal,

stash list

As you can see from the above image, there are 3 stashes called stash@{0}, stash@{1}, and stash@{2}.

To pop out the stash@{2} you need to type like this to the terminal and press enter,

git stash apply stash@{2}
Enter fullscreen mode Exit fullscreen mode

That's it! 😃

Feel free to share if you found this useful 😃.


Top comments (0)