Get git stash parent commit

99封情书 提交于 2021-02-05 06:10:29

问题


Is there a way to retrieve the commit from which a stash was originally created?

When creating a stash with the default command git stash the original commit is saved in the stash message, so it usually looks like:

stash@{0}: WIP on master: abc123 This is the message of some commit.

However, if git stash save 'a stash message' is used, the commit does not appear in the stash list:

stash@{1}: On master: my own message

So how could it be retrieved?


回答1:


I'd say

git log -1 commitish^

E.g.

git log -1 stash@{0}^

Otherwise,

git log -g --no-walk --parents refs/stash


来源:https://stackoverflow.com/questions/16071720/get-git-stash-parent-commit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!