I have found the following to list all "autostash" commits:
git log --pretty='%cr: %h %s' $(git fsck --no-reflog \
| grep '^dangling commit' | cut -f3 -d\ ) | grep ': autostash$'
You can then use the commit hash to get the commit back, e.g. using git show
or git cherry-pick
.
The output looks like this:
Checking object directories: 100% (256/256), done.
2 minutes ago: 7a50bcb On improve-moving-out-of-zoomed-tmux-pane: autostash
22 minutes ago: 9c504af On pr-123: autostash
5 weeks ago: f216b45 On look-for-vim-with-pgrep-ps: autostash
9 weeks ago: f405faa On look-for-vim-with-pgrep-ps: autostash
10 weeks ago: 28ddead On look-for-vim-with-pgrep-ps: autostash