git 在不应用的情况下查看存储中的内容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10725729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 13:45:37  来源:igfitidea点击:

See what's in a stash without applying it

gitgit-stash

提问by Chris Abrams

I see hereyou can apply/unapply a stash and even create a new branch off of a stash. Is it possible to simply see what is inside the stash without actually applying it?

在这里看到您可以应用/取消应用存储,甚至可以从存储中创建一个新分支。是否可以简单地查看存储中的内容而不实际应用它?

回答by simont

From the man git-stashpage:

man git-stash页面:

The modifications stashed away by this command can be listed with git stash list, inspected with git stash show

这个命令隐藏的修改可以用 git stash list 列出,用 git stash show 检查

show [<stash>]
       Show the changes recorded in the stash as a diff between the stashed state and
       its original parent. When no <stash> is given, shows the latest one. By default,
       the command shows the diffstat, but it will accept any format known to git diff
       (e.g., git stash show -p stash@{1} to view the second most recent stash in patch
       form).

To list the stashed modifications

列出隐藏的修改

git stash list

git stash list

To show files changed in the last stash

显示上次存储中更改的文件

git stash show

git stash show

So, to view the content of the most recent stash, run

因此,要查看最新存储的内容,请运行

git stash show -p

To view the content of an arbitrary stash, run something like

要查看任意存储的内容,请运行类似

git stash show -p stash@{1}