我尝试使用Xcode中的命令行进行项目合并,但我认为需要删除一个文件。这是一个在我正在合并的分支中不存在,但在我要合并的另一个分支中存在的文件。问题是它的名字中有一个空格。
TestService/TestService copy-Info.plist
我该如何删除那个文件?谢谢!
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/
然后输入文件名的一部分并再次按下Tab键:
$ 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中的工作原理。