假设我有 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 存储中提取单个文件(或对文件的更改(? 您可以:
git diff stash@{0}^! -- a.txt