Lesson

Git Help

10 min reading
Free Course

Git Help: Using Built-In Documentation in the Terminal

Git ships with complete offline manuals and quick flag summaries for every subcommand. Knowing how to call git help and -h saves time when you forget a flag name or want to verify exact command behavior without leaving your terminal.

Quick Inline Flag Summaries (-h)

When you only need a fast reminder of available options without opening a full manual page, pass -h after any subcommand:

git commit -h
git restore -h

The -h flag prints concise usage syntax and flag descriptions straight to your terminal output and returns your prompt immediately.

Opening Full Manual Pages (git help and --help)

For detailed explanations, edge cases, and examples, open the full reference page using either git help <command> or git <command> --help:

git help branch
git switch --help

On macOS and Linux, this opens the man page inside a scrollable pager. On Windows using Git Bash, --help opens a clean local HTML manual page directly in your default web browser.

Discovering Commands and Concept Guides

List all core commands, plumbing commands, and built-in conceptual tutorials directly from the CLI:

git help
git help -a
git help -g

git help -g lists topic guides such as gittutorial, gitworkflows, gitignore, and gitrevisions. You can read any guide immediately by running git help gitworkflows.

Navigating the Terminal Manual Pager

When git help opens inside your terminal pager (less), remember four keyboard shortcuts:

  • Space or PageDown: Move down one screen.
  • b: Move back up one screen.
  • /pattern then Enter: Search forward for a flag or keyword (press n for the next match).
  • q: Quit and return to the shell prompt.

Frequently Asked Questions

What is the difference between -h and --help in Git?

-h prints a short flag summary directly in your terminal window, while --help opens the comprehensive manual page with full technical notes and examples.

Does git help require an internet connection?

No. All manual pages and local HTML docs are bundled with your Git installation, so they work completely offline.

Why does git help open a browser on Windows?

Git for Windows configures help.format to html by default because Windows does not include the Unix man viewer. You can switch to terminal text output if preferred by running git config --global help.format man inside Git Bash.

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol
Git Topic Hub

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum