What is the difference between -- and – before a command option?
In git, we can modify commands with
-s. From looking at the usage, it looks like the double-dash prefix is for option full-names while the single dash is for the abbreviation. Is that right or is there more to it?
2 Solutions collect form web for “What is the difference between -- and – before a command option?”
Many of the fully named options (i.e., those prefixed with a
--) have a shorthand prefixed with a single
git log --grep=mureinik -i is equivalent to
git log --grep=mureinik --regexp-ignore-case.
If the option takes an argument, note that the shorthand switches are separated from their arguments with a whitespace, while the longer names use the
= operator. E.g.,
git log -n 10 is equivalent to
git log --max-count=10.
That is indeed the difference.
Many commands allow you to “bundle” options. For those commands,
is the same as
foo -b -a -r
To distinguish bundled options from options with longer names,
-- is used to indicate that latter. That means that
only specifies one option.
This is a well known convention adopted by all tools that want to avoid confusion.