First find the reference for the entry you want through looking at the stash:
$ git stash list
stash@{0}: WIP on feature/foo
stash@{1}: WIP on feature/bar
stash@{2}: WIP on fix/baz
Now you can simply use that reference, but curly braces must be escaped:
git stash pop stash@\{1\}
or quoted:
git stash apply "stash@{1}"
apply
applies the entry to the working directory but will not delete it from the stashpop
applies and deletes the entry from the stash (only if there were no conflicts when applying it)drop
will only delete and not apply the entryRunning these commands without a reference will use it with the last entry.
Sometimes you only want to pop
parts of the stash. Do this the way vice versa:
git stash pop
git stash -p # Now move all the unnecessary parts back into the stash
To show the code changes of the last (or any other) stash in patch format, use the following command:
git stash show -p
git stash show -p stash@{1} # to view the second most recent entry in patch form
tig
offers an easy way to browse through the contents of your stash as well: tig stash
. Navigating works as expected.