git rm文件名和空格 [英] git rm file name with space

查看:104
本文介绍了git rm文件名和空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在Xcode中为项目合并命令行,我认为需要删除一个文件。这是一个存在于我合并的分支中的文件,但不是我正在合并的分支。问题是它的名称中有一个空格:

  TestService / TestService copy-Info.plist 

如何删除该文件?谢谢!

解决方案

使用 rm 删除这样的文件:引用名称:

  git rmTestService / TestService copy-Info.plist
code>

  git rm 'TestService / TestService copy-Info.plist'

  git rm TestService / TestService \ copy-Info.plist 

根据您的shell和其他文件的名称,选项卡完成可能对此有所帮助。打字



$ git rm Te 标签



可能会完成目录名称:



$ git rm TestingService /



然后输入部分文件名和另一个选项卡:
$ b $ p $ git rm TestService / Te Tab



将完成文件名,包括插入的 \ 来转义空格字符:
$ b $ p $ git rm TestService / TestService \ copy-Info.plist



但是标签填写通常只会根据所有可用的文件扩展一个唯一的前缀,所以这可能会也可能不行。


I tried merging with the command line for a project in Xcode and I think a file needs to be removed. It is a file that exists in the branch I was merging from, but not the branch I was merging into. The problem is it has a space in the name:

TestService/TestService copy-Info.plist

How do I remove that file? thanks!

解决方案

The same way you'd use rm to remove such a file: quote the name:

git rm "TestService/TestService copy-Info.plist"

or

git rm 'TestService/TestService copy-Info.plist'

or

git rm TestService/TestService\ copy-Info.plist

Depending on your shell and the names of other files, tab completion may help with this. Typing

$ git rm TeTab

will likely complete the directory name:

$ git rm TestingService/

Then typing part of the file name and another tab:

$ git rm TestService/TeTab

will complete the filename, including an inserted \ to escape the space character:

$ git rm TestService/TestService\ copy-Info.plist

But tab completion usually only expands a unique prefix based on all the files available, so this may or may not work.

这篇关于git rm文件名和空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆