如何在 Git 中没有更改的情况下取消暂存文件?

How to unstage files with no changes in Git?

我正在使用 VS 2017。

在提交时,我可以看到一些没有突出显示更改的文件出现在更改下。
有超过 50 个文件没有任何更改存在于更改中。

任何人都可以帮助我如何从更改中删除它们并仅暂存修改后的文件。

首先在命令行中检查您的 git config core.autocrlf 值。

如果你看到 true:

  • 关闭Visual Studio
  • 将其更改为 falsegit config --global core.autocrlf false(如 this thread 中所示)
  • 转到您的项目根文件夹和 (using Git 2.16+) git add --renormalize .
  • 打开备份Visual Studio

查看所有这些文件是否仍在“更改”。