There are some git commands that require double dashes rather than single ones. For example
git reset --hard
Why is is that some commands require a single dash and others a double dash in git?
There are some git commands that require double dashes rather than single ones. For example
git reset --hard
Why is is that some commands require a single dash and others a double dash in git?
Options with --
are so called "long options". They are compatible to the GNU getopt()
function. Check the function's manual for more information about the option syntax: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
Quote from Wikipedia:
In Unix-like systems, the ASCII hyphen-minus is commonly used to specify options. The character is usually followed by one or more letters. Two hyphen-minus characters ( -- ) often indicate that the remaining arguments should not be treated as options, which is useful for example if a file name itself begins with a hyphen, or if further arguments are meant for an inner command. Double hyphen-minuses are also sometimes used to prefix "long options" where more descriptive option names are used. This is a common feature of GNU software. Wikipedia
I hope that explains it!