Is it possible to preview stash contents in git?

git stash show will show you the files that changed in your most recent stash. You can add the -p option to show the diff.

git stash show -p

If the stash you are interested in is not the most recent one, then add the name of the stash to the end of the command:

git stash show -p stash@{2}

To view a current list of stash:

git stash list

You'll see a list like this:

stash@{0}: WIP on ...
stash@{1}: ...
stash@{2}: ...
...

To view diff on any of those stashes:

git stash show -p stash@{n}

I'm a fan of gitk's graphical UI to visualize git repos. You can view the last item stashed with:

gitk stash

You can also use view any of your stashed changes (as listed by git stash list). For example:

gitk stash@{2}

In the below screenshot, you can see the stash as a commit in the upper-left, when and where it came from in commit history, the list of files modified on the bottom right, and the line-by-line diff in the lower-left. All while the stash is still tucked away.

gitk viewing a stash

Tags:

Git

Git Stash