How to read git command options

251 Views Asked by At

Whenever I need to learn more about a git command I run into the documentation which is helpful but I don't understand the particular syntax that is used to describe the possible options.

For example

git help [-a|--all] [-g|--guide]
       [-i|--info|-m|--man|-w|--web] [COMMAND|GUIDE]

What is this formatting or syntax called ? I can infer that [a|--all] means -a or --all.

I don't understand why some options are separated and some are grouped into square brackets.

This is a simple example there are more complicated commands.

I tried using git help help but I didn't find anything useful (unless I missed something).

1

There are 1 best solutions below

4
On

[] means the option is optional

[a|b|c..|d] means any of the a, b, c, .., or d can be used for this particular option.

So if you want to see all the available commands use

git help -a or git help --all