我尝试在 Xcode 中与命令行合并一个项目,我认为需要删除一个文件。它是存在于我要合并的分支中的文件,但不存在于我要合并的分支中。问题是名称中有空格:
TestService/TestService copy-Info.plist
如何删除该文件?谢谢!
我尝试在 Xcode 中与命令行合并一个项目,我认为需要删除一个文件。它是存在于我要合并的分支中的文件,但不存在于我要合并的分支中。问题是名称中有空格:
TestService/TestService copy-Info.plist
如何删除该文件?谢谢!
与删除此类文件相同的方式rm
:引用名称:
git rm "TestService/TestService copy-Info.plist"
或者
git rm 'TestService/TestService copy-Info.plist'
或者
git rm TestService/TestService\ copy-Info.plist
根据您的 shell 和其他文件的名称,制表符补全可能对此有所帮助。打字
$ git rm Te
Tab
可能会完成目录名称:
$ git rm TestingService/
然后输入部分文件名和另一个选项卡:
$ git rm TestService/Te
Tab
将完成文件名,包括一个插入\
以转义空格字符:
$ git rm TestService/TestService\ copy-Info.plist
但制表符补全通常仅根据所有可用文件扩展一个唯一前缀,因此这可能有效,也可能无效。
您可以引用文件名:
git rm "TestService/TestService copy-Info.plist"
或者逃离空间:
git rm TestService/TestService\ copy-Info.plist
如果您使用 Ubuntu,有时您需要使用git rm --cached -r "TestService/TestService copy-Info.plist"
您是否尝试在文件名中添加引号?"TestService/TestService copy-Info.plist"
我不是 100% 确定它是如何与 Git 一起工作的。