DEV Community

Discussion on: Learn the hidden feature in Git - Stash

Collapse
 
lucassperez profile image
Lucas Perez • Edited

Git stash can sometimes be very useful, specially because we can't switch branches with modified files around.
Another way is to simply type git stash, it will put everything in the stash with a WIP message automatically. Then you can do git stash pop to pop the last added entry to the stash (:

Collapse
 
yuvgeek profile image
Yuvaraj

You are correct. But, when we have multiple stash and If one would like to apply the stash which is in the middle, then pop doesn't solve it.

Collapse
 
branislavtotic profile image
Branislav Totic

From git version 2.11 you can do git stash pop stash@{n}, or even better
you can just use index instead stash@{n} like git stash pop n.

Collapse
 
lucassperez profile image
Lucas Perez

Or when we want to stash specific files, we can't simply git stash too, as it will stash everything!

Thread Thread
 
yuvgeek profile image
Yuvaraj

Yesss!

Some comments have been hidden by the post's author - find out more