git: List just the files modified for all stashes
git stash list --name-status
Output:
stash@{0}: WIP on branch-name: face0ff97 Commit message
M path/to/modified/file.cpp
A path/to/added/file.xml
D path/to/deleted/file.kt
stash@{1}: WIP on branch-name: 953add384 Commit message
...
git stash show -p
to show the stash in patch form is which I believe you are asking for.
For a specific stash, you could do the following: git stash show -p stash@{x}
where x is the stash # on the stack.
If listing all files for one stash, e.g. the latest stash, use
git show stash@{0} --stat
Update for Git v2.2 onwards:
git stash list --stat
works.
Things have changed since the question was asked and OP's dilemma no longer applies. From Git v2.2 onwards, you can simply pass --stat
to git stash list
and it will behave as intuitively expected.
You can also use any of the other file listing options such as --name-status
, --name-only
and --raw
available to git log
.
The original answer below applies if you're using a version of Git prior to v2.2.
Original answer:
Like this I guess:
git stash list | while IFS=: read STASH ETC; do echo "$STASH: $ETC"; git diff --stat $STASH~..$STASH --; done
(Tested in Git Bash msysgit.)
git stash show $STASH
instead of git diff --stat $STASH~..$STASH
also worked but was unbearably slow.