"git stash create x" - Where is it?

git

Solution

If you use the script in this answer, you can then do `git stash list`.

#!/bin/sh
#
# git-stash-push
# Push working tree onto the stash without modifying working tree.
# First argument (optional) is the stash message.
if [ -n "$1" ]; then
        git update-ref -m "$1" refs/stash "$(git stash create \"$1\")"
else
        HASH=`git stash create`
        MESSAGE=`git --no-pager log -1 --pretty="tformat:%-s" "$HASH"`
        git update-ref -m "$MESSAGE" refs/stash "$HASH"
fi

Then you may actually want to get that commit back at some point. To do this, you can list the stashes using `git stash list` which gives you something like this (remember, these can be dumb commit messages):

stash@{0}: WTF? Nothing is working
stash@{1}: it's all working perfectlY!
stash@{2}: blah2

Then you can restore, say, `blah2` by running:

 git stash pop stash@{2}

or as @Eliot points out, you can use this to not destroy your stash:

 git stash apply stash@{2}

Problem

If I create a commit with `git stash create whatever` I get a hash of the commit back, but I can't find that commit hash with `git reflog`. `git log stash` doesn't work either, not does `git stash list`. How can I list the commits I create using `git stash create`?

Original source

Related problems