如何使用git还原来拆除名称包含点的文件

发布于 2025-01-22 06:41:41 字数 376 浏览 0 评论 0原文

我要拆下一个名称包含点的文件。当我在下面命令下运行错误时,它会给我带来错误

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,函数,脚本文件或可操作程序的名称。检查名称的拼写,或者如果包括路径,请验证该路径是否正确,然后重试。

有人可以指导我如何解决此错误并拆除此文件吗?谢谢。

I'm going to unstage a file which name contains dot. It game me a fetal error when I ran below command

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

with error :
The term 'd.18' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Could anybody guide me how to fix this error and unstage this file? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡淡的优雅 2025-01-29 06:41:42

问题不是点,而是括号 d.18 被外壳解释。引用整个论点将阻止外壳解释字符串内的括号,这也将使整个字符串保持在内,包括一个参数

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"

: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about/about_quoting_rules?view=powershell-7.2“ /en-us/powershell/module/microsoft.powershell.core/about/about/about_quoting_rules?view=powsepowpowpowshell-7.2 ,错误消息的“ cmdlet”一部分是您可能使用powershell和不是powershell的提示UNIX壳。)

The problem is not the dot, but the parentheses ( and ) around d.18 being interpreted by the shell. Quoting the whole argument will stop the shell from interpreting the parentheses inside the string, which will also keep the whole string including spaces as one argument:

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"

(This is going off my extensive knowledge of PowerShell which extends to quickly glancing at https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.2, the "cmdlet" part of the error message being the hint that you are probably using PowerShell and not a Unix shell.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文