Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "[]" or "<>" mean in some command document? [duplicate]

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?

like image 899
YuZhou Hong Avatar asked Jun 28 '17 08:06

YuZhou Hong


People also ask

What is Document command?

DOCUMENT saves a block of text of any length in data files saved in IBM® SPSS® Statistics format. The documentation can be displayed with the DISPLAY command. (See also ADD DOCUMENT .)

What is command syntax options?

In the computer world, the syntax of a command refers to the rules in which the command must be run in order for a piece of software to understand it. For example, a command's syntax may dictate case-sensitivity and what kinds of options are available that make the command operate in different ways.

What does command line do?

The command line is an interface to your computer's files and directories. The command line provides a way to communicate with your computer. Its language takes the form of text-based input and output.


1 Answers

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.

like image 57
C-Otto Avatar answered Oct 07 '22 23:10

C-Otto