在git中转义时会在前面添加一个前导“-".在文件名中? [英] Escaping in git add a leading "-" in the filename?
本文介绍了在git中转义时会在前面添加一个前导“-".在文件名中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在git中添加如何转义文件名中的前导-"字符?例如:
In git add how can you escape a leading "-" character in the filename? e.g.:
git add -index-apache-.html
给予:
error: unknown switch `d'
谢谢!
PS.
git checkout
推荐答案
使用--
可以解决此问题.超过双破折号的任何内容都将被视为文件名.
Use the --
to get around this issue. Anything past the double-dash is treated as just a filename.
与Git约定相比,这更像是Bash约定,因为--
传统上表示结尾选项.
This is more a Bash convention than a Git convention, as --
traditionally signifies the end of options.
A
--
向选项结束发出信号,并禁用进一步的选项处理.--
之后的所有参数都被视为文件名和参数.-
的参数等效于--
.
A
--
signals the end of options and disables further option processing. Any arguments after the--
are treated as filenames and arguments. An argument of-
is equivalent to--
.
这篇关于在git中转义时会在前面添加一个前导“-".在文件名中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文