简体   繁体   English

为什么 'git add --al' 与单个 'l' 一起工作?

[英]Why is 'git add --al' with single 'l' working?

In git bash I typed git add --al (with single 'l' ) by mistake, and it worked.在 git bash 中,我错误地输入git add --al (带有单个'l' ),它起作用了。 From the documentation I can't see the option with single 'l' letter.文档中我看不到带有单个“l”字母的选项。

I Searched on google and couldn't find any explanation.我在谷歌上搜索并找不到任何解释。

Not important, just for curiosity: Now whenever I type --all I can't stop myself thinking " If I'm wasting my time with typing second 'l' ":)不重要,只是出于好奇:现在每当我输入--all我都无法阻止自己思考“如果我在浪费时间输入第二个‘l’ ”:)

#Git options abbreviation #Git选项缩写

Abbreviating long form options is usually allowed, if the result is unambigous, according to the conventions (emphasis mine):根据惯例(强调我的),如果结果明确,通常允许缩写长格式选项:

Many commands allow a long option --option to be abbreviated only to their unique prefix (eg if there is no other option whose name begins with opt , you may be able to spell --opt to invoke the --option flag), but you should fully spell them out when writing your scripts;许多命令只允许将长选项--option缩写为它们唯一的前缀(例如,如果没有名称以opt开头的其他选项,您可以拼写--opt来调用--option标志),但是你应该在写剧本的时候把它们完整地拼出来; later versions of Git may introduce a new option whose name shares the same prefix, eg --optimize , to make a short prefix that used to be unique no longer unique. Git 的更高版本可能会引入一个新选项,其名称共享相同的前缀,例如--optimize ,以使过去唯一的短前缀不再唯一。

Since (as of now) --al only prefixes a single legal long option for git-add , it will be accepted as --all .由于(截至目前) --al仅在git-add的单个合法长选项前加上前缀,因此它将被接受为--all Theoretically even gid add --a could work.理论上,甚至gid add --a也可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM