如何使用 git restore 取消暂存名称包含点的文件

How to use git restore to unstage a file which name contains dot

我要取消暂存名称中包含点的文件。当我 运行 低于命令

时,它让我犯了一个胎儿错误
git restore --staged MS0010-7(d.18) TSG Automated Buildouts - PaaSV2 buildout failed in initialize step due to DA could not ping any of the provided Service Fabric gateway endpoints-img001.png

有错误: 术语 'd.18' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。

有人可以指导我如何修复此错误并取消暂存此文件吗?谢谢

问题不在于点,而是由 shell 解释 d.18 周围的括号 ()。引用整个参数将阻止 shell 解释字符串中的括号,这也会将包括空格的整个字符串作为一个参数:

git restore --staged "MS0010-7(d.18) TSG Automated Buildouts - PaaSV2 buildout failed in initialize step due to DA could not ping any of the provided Service Fabric gateway endpoints-img001.png"

(这超出了我对 PowerShell 的广泛了解,扩展到快速浏览 https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.2,错误消息的“cmdlet”部分暗示您可能使用的是 PowerShell 而不是 Unix shell.)