Skip to content
Tutorials Center
My learning

Topics

Git Reference ยท Setup and Basics

git help command

Reference for git help: show manual pages for commands, concept guides and config variables, choose man, web or info output, and list all commands.

git help shows documentation. git help commit opens the manual page for git commit, git help -g lists the concept guides such as gitglossary and gitrevisions, and git help -c lists every configuration variable. It is the fastest way to confirm exactly what an option does in the Git version you actually have installed.

Every command also answers -h with a short usage summary and --help with the full manual, so git commit -h and git help commit are two doors into the same documentation (the first never needs a viewer).

Terminal
git help <command-or-guide>
git <command> -h

Try it

Bash Short usage, listings and guides

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash Which format would be used?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
git help [-a|--all] [-g|--guides] [-c|--config] [--no-verbose]
git help [-m|--man | -w|--web | -i|--info] <topic>
Option Description
<topic> A command (rebase), a guide (gitignore, gitworkflows, giteveryday) or a file format page. git help git shows the top-level page.
-a, --all List all available commands, grouped by category.
--no-verbose With -a, print only command names.
-g, --guides List the concept guides.
-c, --config List all configuration variable names.
--user-interfaces, --developer-interfaces List interface-specific guides (git-specific files vs. protocols, hooks, and so on).
-m, --man Use the man viewer.
-w, --web Open the HTML pages in a browser.
-i, --info Use the info viewer.
--no-aliases, --no-external-commands With -a, leave aliases or external git-* programs out of the listing.

Behavior when nothing is found: an unknown topic prints No manual entry or 'xyz' is not a git command and exits with a nonzero status. If the name is an alias, git help prints what it expands to instead of a manual.

Usage notes

  • Viewer choice. The default is man. Override it with help.format (man, info, web, html) or per call with -m, -w, -i. help.browser and web.browser pick the browser for the web format.
  • Pages need to be installed. Some distributions ship the manuals in a separate package, and minimal environments (containers, this site's runner) have none; git help <command> may then report that no manual is available, while -h still works.
  • Command spellings. git help add, git add --help and man git-add all show the same page. git help -a also lists plumbing and external commands found on PATH (executables named git-something).
  • Typo correction. help.autocorrect controls what Git does when you type an unknown command: 0 just suggests, prompt asks, a positive number is a delay in tenths of a second, immediate runs the guess at once, never disables it. Auto-running guesses is risky for destructive commands, so prefer prompt.
  • Exit codes in scripts. git <cmd> -h exits with 129 (usage error), not 0, which surprises people who test it in scripts.
  • Searching. Inside a man viewer press / and the word, and n for the next hit. Option descriptions in manuals are the reference for edge cases; this site explains the behavior in its own words.
  • Online docs follow the latest release. The man pages on your machine match the Git you run, which is why you should check them when a flag seems to be missing.