我隐藏保存未跟踪的文件后,git stash不显示给我

lyr*_*yrl 4 git

我使用后,git stash不会显示未跟踪的文件git stash save -u

D:\kzxd-usm\KzxdUsm>git status
Already up-to-date!
# On branch work
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       WebRoot/WEB-INF/jsp/usm/org/Copy of list.jsp
nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)

我想列出未跟踪的文件,并将其保存为git stash save -u

D:\kzxd-usm\KzxdUsm>git stash list --stat
stash@{0}: On work: hide copy of list.jsp
Run Code Online (Sandbox Code Playgroud)

它只有一点注释文本,没有隐藏的文件信息。

nak*_*eer 7

用于git show stash@{0}^3显示所有隐藏的未跟踪文件。

  • 稍微解释一下为什么行得通,这很好。 (7认同)

sim*_*ont 0

git stash只会存储 git 知道的文件中的更改:它不会存储未跟踪文件中的更改。

您可以使用 告诉 git 有关该文件的信息git add,然后使用以下命令隐藏更改git stash

git add Copy\ of\ list.jsp
git stash
Run Code Online (Sandbox Code Playgroud)

  • 确实如此,但 `-u/--include-untracked` 会添加它们。通常您想隐藏未跟踪的文件。问题是如何显示未跟踪的隐藏文件。这个问题吓坏了我,因为我以为我不知何故丢失了上周所做的所有工作(“该死,我一定已经将它们重新设置为不存在了”)。我不喜欢这种不显示未跟踪的隐藏文件的行为。 (2认同)