如何git stash显示仅对一个文件的更改?

时间:2020-03-06 14:00:07

标签: git diff

我知道您可以使用git stash show stashID -p查看对文件的更改,如果弹出特定存储的内容,这些更改将被应用。有没有办法只查看与一个特定文件的差异? git stash的帮助部分说

By default, the command shows the diffstat, but it will accept any format known to git diff

但是git stash show stashID -p <filepath>无效,因为<filepath>似乎被视为另一个存储ID。

1 个答案:

答案 0 :(得分:0)

只需在--之后添加文件路径

git show stash@{n} -- path/to/file

(这里-p是多余的,因为它是默认行为)

相关问题