I often put work away for later, then other stuff comes along, and a few weeks later, I want to inspect the stash, and find out what changes it would make if I applied it to
You can view all stashes' list by the following command:
$ git stash list
stash@{0}: WIP on dev: ffffd4d75 spelling fix
stash@{1}: WIP on dev: 40e65a8 setting width for messages
......
......
......
stash@{12}: WIP on dev: 264fdab added token based auth
Newest stash is the first one.
You can simply select index n
of stash provided in the above list and use the following command to view stashed details
git stash show -p stash@{3}
Similarly,
git stash show -p stash@{n}
You can also check diff by using the command :
git diff HEAD stash@{n} -- /path/to/file
View list of stashed changes
git stash list
For viewing list of files changed in a particular stash
git stash show -p stash@{0} --name-only
For viewing a particular file in stash
git show stash@{0} path/to/file
You can review the stashed changes in VSCode with gitlen extension
screenshot of gitlen stashes
Beyond the gitk recommendation in Is it possible to preview stash contents in git? you can install tig and call tig stash
. This free/open console program also allows you to choose which stash to compare