Search code examples
gitgit-stash

List modified file names in a git stash


Can I list the names of the modified files in a stash, without their contents?

While searching, I only found people printing the whole diff, couldn't manage to view the filenames only.


Solution

  • The show sub-command, in the end, invokes git diff with whatever flags you have set, or --stat if you did not set any, so simply git stash show --name-only, which runs git diff --name-only between the base commit and the work-tree commit.

    (See here and here for a description of what I have taken to calling a "git stash-bag". You get a diff between the commit the bag hangs from, and the w commit.)