Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List modified file names in a git stash

Tags:

git

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.

like image 275
o0'. Avatar asked Sep 12 '14 11:09

o0'.


People also ask

How can I see my git stash list?

Git Stash List. The Git stash list command will pull up a list of your repository's stashes. Git will display all of your stashes and a corresponding stash index. Now, if you wish to view the contents of a specific stash, you can run the Git stash show command followed by stash@ and the desired index.

What does git stash list do?

git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on.


1 Answers

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.)

like image 64
torek Avatar answered Sep 20 '22 06:09

torek