LinuxCommandLibrary

gh-help

Display GitHub CLI help information

TLDR

Display general help

$ gh help
copy

Display help for the gh help subcommand
$ gh help [[-h|--help]]
copy

Display help about environment variables that can be used with gh
$ gh help environment
copy

Display a markdown reference of all gh commands
$ gh help reference
copy

Display help about formatting JSON output from gh using jq
$ gh help formatting
copy

Display help about using gh with MinTTY
$ gh help mintty
copy

Display help for a subcommand
$ gh help [subcommand]
copy

Display help for a subcommand action
$ gh help [pr] [create]
copy

SYNOPSIS

gh help [<command>] [--all|-a] [--json|-J] [--man|-m]

PARAMETERS

<command>
    Subcommand to show detailed help for (positional argument)

-a, --all
    Show all available commands, including aliases and hidden ones

-J, --json
    Output commands in machine-readable JSON format

-m, --man
    Generate and display the manual page for the command

DESCRIPTION

The gh help command is a built-in utility within the GitHub CLI (gh), an official command-line tool for interacting with GitHub. It provides detailed usage information, options, and examples for the gh tool itself or any of its subcommands.

When invoked without arguments, it lists all available top-level commands with brief descriptions. Specifying a subcommand like gh help repo drills down into that command's syntax, flags, and examples. This makes it invaluable for quick reference during scripting, automation, or daily GitHub workflows from the terminal.

Key features include formatted output for readability, support for JSON export for programmatic use, and man page generation. It's especially useful for developers managing repositories, issues, pull requests, and more via CLI, reducing reliance on web interfaces or external docs. Output is context-aware, adapting to the specified command's complexity.

CAVEATS

Requires gh to be installed and authenticated with GitHub. JSON output structure may evolve between versions; parse cautiously in scripts.

EXAMPLES

gh help # List all top-level commands
gh help pr # Help for pull request subcommands
gh help --json # JSON output of all commands
gh help repo --man # View repo command man page

AUTHENTICATION

Help content may reference auth-dependent features; run gh auth login first for full context.

HISTORY

Introduced with GitHub CLI v0.5.0 in February 2020. GitHub CLI, developed by GitHub (now Microsoft), reached v1.0 in December 2020 and is actively maintained with regular updates for new GitHub features.

SEE ALSO

gh(1), man(1), git(1)

Copied to clipboard