Documentation

Author

Marie-Hélène Burle

Git comes with internal documentation. This section covers how to access it.

Manual pages

The manual page for any Git command can be open with:

git help <command>

Example:

git help commit

On Unix systems (Linux and MacOS), you can alternatively use the man command this way:

man git-<command>

Example:

man git-commit

Finally, many commands come with an help flag:

git <command> --help

Example:

git commit --help

All these methods lead to the same thing: the manual page corresponding to the command will open in a pager (usually less). A pager is a program which makes it easier to read documents in the command line.

Useful keybindings when you are in the pager:

SPACE      scroll one screen down
b          backa one screen
q          quit the pager
g          go to the top of the document
7g         go to line 7 from the top
G          go to the bottom of the document
/          search for a term
           n will take you to the next result
           N to the previous result

Command options

Instead of opening the full manual in the pager, if you want to simply output the various flags (options) for a command directly in the terminal, you can use:

git <command> -h

Example:

git commit -h