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
git rebase --continue
will resume it, whilegit rebase --abort
should terminate and re-apply the autostash. If it does not re-apply the autostash, that's a bug (I'm pretty sure there was such a bug for a while, so your Q+A is actually useful, but if you have the bug, you should upgrade your Git).git rebase --continue
saysNo rebase in progress?
.GIT_SEQUENCE_EDITOR=false git rebase -i --autostash
.