How to list parent wallet commit in `git stash list`

When I create stash in git, there is a “parent” (the last commit before I hid my changes).

When I use git stashto hide my changes, the identifier of this parent commit is added to the message describing my wallet. a call git stash listmay, for example, show:

stash@{0}: WIP on master: c09a3fc second commit
stash@{1}: WIP on master: 063b893 first commit
stash@{2}: WIP on master: 063b893 first commit

But when I run git stash save "My own message", the parent-commit id is not added ( git stash list):

stash@{0}: On master: My own message
stash@{1}: WIP on master: c09a3fc second commit
stash@{2}: WIP on master: 063b893 first commit
stash@{3}: WIP on master: 063b893 first commit

Is there a way to show the parent commit id in the delay list?

I tried: git stash list --oneline --parentswhich gave me:

1b5dfb1 4efd3e0 refs/stash@{0}: On master: My own message
4efd3e0 1e9b384 refs/stash@{1}: WIP on master: c09a3fc second commit
1e9b384 51eb834 refs/stash@{2}: WIP on master: 063b893 first commit
51eb834 refs/stash@{3}: WIP on master: 063b893 first commit

But the wrong identifiers are shown here. I expected (the first line does not match the parent-commit id, which is the same for groups of two commits in this example):

c09a3fc 1b5dfb1 refs/stash@{0}: On master: My own message
c09a3fc 4efd3e0 refs/stash@{1}: WIP on master: c09a3fc second commit
063b893 1e9b384 refs/stash@{2}: WIP on master: 063b893 first commit
063b893 51eb834 refs/stash@{3}: WIP on master: 063b893 first commit
+4
1

, , ID . :

$ git stash save "My own message"

:

$ git stash save "[$(git rev-parse --short HEAD)] My own message"

( - , git, ).

, , git stash. . , , , commit w (refs/stash reflog w commit) - , HEAD .

git stash list git log, --oneline --parents , git log, , git stash list :

git log --format="%gd: %gs" -g --first-parent -m "$@" $ref_stash --

( "$@" - ). , --parents (. git rev-list), -g " " reflog walk", .

(, , --first-parent , , --parents . --parents , . , git , reflog clobber , clobber, , . , git, .)

() , , (w ) git rev-parse, w commit:

git log -g --format="%gd %H" refs/stash |
while read name hash; do
    printf "%s %s " $name $(git rev-parse --short $name^)
    git log -1 --format=%s $hash
done

( , ).

+4

All Articles