git stash doesn't show untracked files after I use git stash save -u
:
D:\kzxd-usm\KzxdUsm>git status
Already up-to-date!
# On branch work
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# WebRoot/WEB-INF/jsp/usm/org/Copy of list.jsp
nothing added to commit but untracked files present (use "git add" to track)
I want list the untracked file after it's stashed with git stash save -u
:
D:\kzxd-usm\KzxdUsm>git stash list --stat
stash@{0}: On work: hide copy of list.jsp
It has only a little comment text and does not have stashed file information.
In my 1.7.8.2, stash@{0}^3 does not work to show untracked files. However, I have found that the following does list them in the the second log entry:
git log -2 --name-only stash@{0}
You can use -p instead of --name-only if you want to see the file details.
If you stash with git stash save -u
and then do git stash show
, untracked files will not be shown -- the listing will contain changes to tracked files only.
It makes sense when you want to share your stashed changes with someone: The diff you get from git stash show
won't contain any extra garbage (the untracked stuff from your working copy) but only the relevant changes to tracked files.
Once you restore your stashed changes with git pop
, the untracked files will be restored as well.
The best answer I found is at In git, is there a way to show untracked stashed files without applying the stash? and this answer in particular - https://stackoverflow.com/a/23712152/1019307.
git rev-list -g stash | git rev-list --stdin --max-parents=0 | xargs git show --stat
use git show stash@{0}^3
to show all the untracked files stashed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With