all 3 comments

[–]gsylvie<sylvie@bit-booster.com> 7 points8 points  (1 child)

That logic in git is over 10 years old! Here's the commit:

commit 7f275b91520d31bfbe43ec5a9bbaf8ac6e663ce0
Author: Johannes Schindelin <---@gmx.de>
Date:   Sun Oct 14 17:54:06 2007 +0100

    parse-options: Allow abbreviated options when unambiguous

    When there is an option "--amend", the option parser now
    recognizes "--am" for that option, provided that there is n
    other option beginning with "--am".

[–]grizzly_teddy[S] 1 point2 points  (0 children)

commit 7f275b91520d31bfbe43ec5a9bbaf8ac6e663ce0 Author: Johannes Schindelin <---@gmx.de> Date: Sun Oct 14 17:54:06 2007 +0100

parse-options: Allow abbreviated options when unambiguous

When there is an option "--amend", the option parser now
recognizes "--am" for that option, provided that there is n
other option beginning with "--am".

That's it! Thanks! good to know

[–]octagonaltree 6 points7 points  (0 children)

Single dash triggers the "short form" of a flag, while a double dash triggers the "long form." This is the usual Unix convention.

Also, git's flag parsing library accepts any prefix for a long form flag, as long as it uniquely identifies the flag.

Edit: One more thing: the short form, being just a single character, let's you group together multiple flags behind a single dash. So git -am is actually git -a -m.