How to read the Git help manual?

Asked

Viewed 124 times

10

I’m trying to learn more about Git and I’m bumping into a basic question, I don’t know how to read the manual. I understand some things, but I’m not sure yet what the symbols are used for: [], <> and (). Below is an example:

git [--version] [--help] [-C <path>] [-c <name>=<value>]
    [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
    [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
    [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
    [--super-prefix=<path>]
    <command> [<args>]

2 answers

18


Everything between brackets is optional (remember that the brackets themselves are not part of the syntax, it only exists to indicate this in the documentation), you use only if it makes sense for what you want. In this example only one text is required, the command. It does not mean that all combinations are possible or make sense.

Everything that is between angles (smaller and larger) are expressions that must be written, so what is written there describes what kind of expression is expected there, obviously not to write that text that is there only in the documentation, but rather a text that makes sense there. The most common is a path to a place.

I have not seen anything in parentheses. This may vary, it may be a grouping.

Has a | which means you have to choose between these options on the list between this exclusive selection "operator", you can not use everything, one is mutually exclusive of the others on the list.

This is more or less standard for documentation, not just in Git.

You don’t have it, but there’s use of reticence when you can fit a list of things. There are notations in some documentations to express forms of use in a more sophisticated way than the one seen here, but the basis is this.

  • Valeu Maniero. ;)

  • This pattern has some name?

  • 1

    @Francisco that I know no, I’ve never seen anything very formal about this.

  • I first saw this pattern in man pages (manuals, command man) by table on GNU/Linux is also like this.

3

Actually, Andre, the git as a tool is much more complex than this preview of what can be done demonstrates. To use the tool you will initially need to understand some basic concepts like: repository, branch and commit. Each command of git has syntax and specific functionalities (almost a world apart).

So, look for tutorials on how to use the tool because it is precisely something in which you need to know exactly what is being done to, of course, focus on the three basic concepts because everything revolves around them.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.