GitGetting Help (git help)

Getting Help (git help)

Git ships with extensive built-in documentation. No matter what command you are stuck on, the answer is usually in your terminal already — not on Stack Overflow. Learning to read Git’s own help will make you self-sufficient much faster than memorising recipes.

Three ways to ask for help

Three equivalent forms

Bash
git help <command>
git <command> --help
man git-<command>

These all open the same documentation. The default on most systems is the man-page viewer; on Windows it opens the HTML docs in your browser.

Quick command summary

Short usage hints (no man page)

Bash
git <command> -h
# Examples:
git commit -h
git log -h
git rebase -h

The short form -h prints just the flag list and brief usage to your terminal — much faster when you only want to remember an option.

Discover what commands exist

List every Git command

Bash
git help -a              # all sub-commands (incl. plumbing)
git help -g              # concept and guide topics
git help --all           # huge alphabetical list

Try git help -g once and skim the list. Topics like gitworkflows, gitcredentials, giteveryday and gitglossary are entire tutorials hidden in your terminal.

The most useful concept guides
  • git help gittutorial — a hands-on first walk-through.

  • git help gittutorial-2 — second-half tutorial covering more.

  • git help giteveryday — “the 20 commands you actually use daily”.

  • git help gitworkflows — how the maintainers recommend organising work.

  • git help gitrevisions — every way to refer to a commit (HEAD~3, branch@{yesterday}, …).

  • git help gitcredentials — how Git stores and retrieves passwords.

  • git help gitglossary — definitions of every Git term.

  • git help gitcli — how Git parses arguments and options.

  • git help gitfaq — frequently asked questions.

Searching the help

Most man-page viewers support /

Bash
git help commit
# Once inside the man page:
#   /commit-tree      ← search forward
#   n                  ← jump to next match
#   ?something         ← search backward
#   q                  ← quit
Reading a Git man page like a pro

Every Git man page follows the same six-section layout:

  • NAME — one-line description.

  • SYNOPSIS — every valid form of the command and its options. The single most useful section once you know what you are doing.

  • DESCRIPTION — long-form explanation.

  • OPTIONS — every flag explained.

  • EXAMPLES — short copy-pasteable recipes.

  • SEE ALSO — related commands and guides.

Hint when you mistype

Did-you-mean suggestions

Bash
git stauts
# git: 'stauts' is not a git command. See 'git --help'.
# The most similar command is
#   status

You can make this even friendlier:

Bash
# Auto-run the suggested command after 1 second
git config --global help.autocorrect 10
Online resources baked into the docs
  • Pro Git book — https://git-scm.com/book/en/v2 — the canonical free book. Use it as your second textbook.

  • Reference manual — https://git-scm.com/docs — the same man pages, but searchable on the web.

  • Git Glossary — https://git-scm.com/docs/gitglossary — definitions of every Git term.

Practical example: looking up a flag

What does --amend really do?

Bash
git commit --help
# In the man page, search for: /--amend
# You'll find:
#   Replace the tip of the current branch by creating a new commit.
#   The recorded tree is prepared as usual ...

That is the right loop: encounter a flag → git <cmd> --help → search for the flag → read the paragraph. Much higher signal than random web results.

Plumbing vs porcelain
Git’s commands are split into low-level “plumbing” (e.g. `git hash-object`, `git update-ref`) and friendly “porcelain” (`git commit`, `git push`). The man pages mark which is which. You will almost never need plumbing directly — but knowing it is there helps when you read advanced Git articles.
Tip
When you encounter an unfamiliar command in someone else’s shell history or in a script, your first move should always be git COMMAND --help. The answer is almost always already on your machine.