如何从 git 状态中删除“<file_path>/file.py~隐藏的更改”

How to remove "<file_path>/file.py~Stashed changes" from git status

在做了一些 git 存储和分支更改之后,我的 git 状态不知何故如下:

Untracked files:  (use "git add <file>..." to include in what will be committed)

    "<file_path>/file.py~Stashed changes"

但是当我尝试执行 git rm <file>git add <file> 时,我得到:

fatal: pathspec '<file_path>/file.py~Stashed' did not match any files

如何从我的 git status 中删除此文件路径?

你应该只使用 rm "<file_path>/file.py~Stashed changes"

根据the manual

git rm Remove files from the index, or from the working tree and the index. git rm will not remove a file from just your working directory.

由于您的文件未被跟踪,git rm 不会删除它。

如果您有很多文件要处理,have a look at git clean