7

In some command documents, there are often "[]" or "<>". For example:

git diff [options] [<commit>] [--] [<path>…​]
git diff [options] --cached [<commit>] [--] [<path>…​]
git diff [options] <commit> <commit> [--] [<path>…​]

What does that mean?

0

1 Answer 1

9

This notation is not only used for git, but for documentation of commands in general.

Arguments in square brackets are optional. You are free to use them at the given position, but you can also decide to just not provide any option. In your example you could just write git diff which corresponds to the first line without any of the optional arguments.

The items given in angle brackets are not to be used verbatim, but instead should be replaced by meaningful content. In your example, <commit> should be replaced by a valid commit identifier, e.g. git diff d6cd1e2bd19e03a81132a23b2025920577f84e37.

Not the answer you're looking for? Browse other questions tagged or ask your own question.