See what's in a stash without applying it

GitGit Stash

Git Problem Overview


I see here you can apply/unapply a stash and even create a new branch off of a stash. Is it possible to simply see what is inside the stash without actually applying it?

Git Solutions


Solution 1 - Git

From man git-stash (which can also be obtained via git help stash):

> The modifications stashed away by this command can be listed with git stash list, inspected with git stash show, and ...

show [<stash>]
    Show the changes recorded in the stash as a diff between the stashed
    state and its original parent. When no <stash> is given, shows the
    latest one. By default, the command shows the diffstat, but it will
    accept any format known to git diff (e.g., git stash show -p stash@{1}
    to view the second most recent stash in patch form).

Note: the -p option generates a patch, as per git-diff documentation.

List the stashes:

git stash list

Show the files in the most recent stash:

git stash show

Show the changes of the most recent stash:

git stash show -p

Show the changes of the named stash:

git stash show -p stash@{1}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChris AbramsView Question on Stackoverflow
Solution 1 - GitsimontView Answer on Stackoverflow