git newbie here: I have a list of stashes:
aws-0292@procolharum MINGW64 ~/phuber/magic (master)
$ git stash list
stash@{0}: On master: 30 or 31
stash@{1}: On master: music
stash@{2}: On master: this party
I would like to see each stash, so I do:
$ git stash apply stash@{0}
works great! I can see what stash#0; now I wish to move to stash#1, in order to do so I have to clear everything so I do:
$ git reset --hard
and then
$ git stash apply stash@{1}
I'm quite sure my process is somewhat wrong, is there a better way without the need of git reset?
CodePudding user response:
You can git checkout
a stash:
git checkout stash@{0}
And when you're done inspecting it, switch back to your branch:
git checkout main
(Or whichever branch name is appropriate.)
Since a stash entry is just a commit reference, you can also use git worktree
to check out the stash in a different directory:
git worktree add ../checked-out-stash stash@{0}
When you're done:
git worktree remove ../checked-out-stash