Inspect a Git stash without applying it: list, files and patches
- Published: 2026.11.08
- Updated: 2026.11.08
- Development
You may have saved some changes in a stash and forgotten which entry contains the work you need. Before bringing anything back into your files, you can inspect the list, the changed files, and then the patch. This makes it easier to choose the right entry while keeping your current edits in place.
Run these commands inside the Git repository. The examples quote 'stash@{0}' so the selector is passed intact in PowerShell.
Choose an entry from the stash list
git stash list
In the test repository, the output was stash@{0}: On main: inspect-example. Use the selector and message to identify the saved work. Creating another stash changes which entry is numbered zero, so check the list again before a later operation.
Start with the changed filenames
git stash show --stat 'stash@{0}'
The summary helps you decide whether an entry contains the files you are looking for. Replace the number inside the quotes when you want a different entry.
Read the saved patch
git stash show --patch 'stash@{0}'
In the reproduced example, this showed base being replaced with stashed-edit in the tracked file. The current working file contained a separate edit and stayed unchanged. To inspect your present changes instead, see checking working and staged changes with Git.
Include untracked files saved in the entry
git stash show --include-untracked --patch 'stash@{0}'
The test used Git 2.51.2 with its default configuration. The ordinary patch showed the tracked file only; adding this option also showed the saved note.txt file. It can only display untracked files that were included when the entry was created. It cannot recover a file that was never saved there.
Display defaults can be changed through Git configuration. Explicit options make the intended view clearer.
Check your current work before restoring anything
git status --short --branch
The five commands above were checked in a separate repository containing both staged and unstaged edits. The file contents, index differences, working-tree differences, and stash reference were identical before and after each command.
Once you have identified the saved work, consider your current edits before restoring it. apply and pop change the working files. Also, entering bare git stash creates a stash rather than listing entries, so keep the list subcommand when you only want to browse.
If your immediate task is to remove changes from the staging area while keeping the edits, use unstaging changes with git restore –staged.
Reference
-
Previous article
Git detached HEAD: keep your work on a branch 2026.11.03
-
Next article
記事がありません