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

Time:04-20

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.

CodePudding user response:

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://docs.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.)

  • Related