Documentation
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 commitOn Unix systems (Linux and macOS), you can alternatively use the man command this way:
man git-<command>Example:
man git-commitFinally, many commands come with an help flag:
git <command> --helpExample:
git commit --helpAll 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 resultCommand 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> -hExample:
git commit -h