简体   繁体   中英

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. From the documentation I can't see the option with single 'l' letter.

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' ":)

#Git options abbreviation

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; 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.

Since (as of now) --al only prefixes a single legal long option for git-add , it will be accepted as --all . Theoretically even gid add --a could work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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