查看Git中1个特定藏匿文件的比较内容

问题描述 投票:0回答:1

假设我有2个隐藏文件:

$ git stash show

a.txt | 2 +-
b.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

我可以查看存储的完整差异:

diff --git a/a.txt b/a.txt
index bc56c4d..a688182 100644
--- a/a.txt
+++ b/a.txt
@@ -1 +1 @@
-Foo
+Baz
diff --git a/b.txt b/b.txt
index ebd7525..4105321 100644
--- a/b.txt
+++ b/b.txt
@@ -1 +1 @@
-Bar
+Qux

更多文件会使输出混乱,因此我只想查看1个特定文件。但是,手册似乎说没有使用文件名参数的选项:

NAME
       git-stash - Stash the changes in a dirty working directory away

SYNOPSIS
       ...
       git stash show [<stash>]
       ...

是否可以查看仅一个特定的隐藏文件的差异内容?

git diff git-stash git-show
1个回答
0
投票
stash apply能为您工作吗?

stash apply

此后,您可以结帐git stash apply 
git diff a.txt
© www.soinside.com 2019 - 2024. All rights reserved.