Search code examples
gitpowershellgit-stash

How to see git stash modification when it was done by git stash push filename


I stash few files earlier by git stash push file_path. Now I can see them as list as by git stash list

stash@{0}: WIP on web_09_11: a6c038e7 Merged PR 25503: Get latst commites
stash@{1}: WIP on web_09_11: a6c038e7 Merged PR 25503: Get latst commites
stash@{2}: WIP on web_09_11: a6c038e7 Merged PR 25503: Get latst commites
stash@{3}: WIP on web_09_11: a6c038e7 Merged PR 25503: Get latst commites

I want to see the content of each stash. I found that it should show if I try

git stash show stash@{1}

But it gives me error as:
fatal: ambiguous argument 'stash@': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this:

Or Too many revisions specified: 'stash@' 'MQA=' 'xml' 'text'

how can I see it?


Solution

  • This is a shell issue : use quotes around 'stash@{xx}'

    git show 'stash@{1}'
    

    In Powershell for example : { cmd1; cmd2 } defines a script block

    Here is an example of what I get :

    > echo stash@{1}
    stash@
    1
    > echo 'stash@{1}'
    stash@{1}