LinuxCommandLibrary

git-help

Display Git command documentation

TLDR

Display help about a specific Git subcommand

$ git help [subcommand]
copy

Display help about a specific Git subcommand in a web browser
$ git help [[-w|--web]] [subcommand]
copy

Display a list of all available Git subcommands
$ git help [[-a|--all]]
copy

List the available guides
$ git help [[-g|--guides]]
copy

List all possible configuration variables
$ git help [[-c|--config]]
copy

SYNOPSIS

git help [--web] [--man] [--info] [--external] [--verbose] [--aliases] [--config] |
git help [-g|--guides]
git help [-a|--all]

PARAMETERS

--web
    Open the help documentation in a web browser. The specific browser used is determined by Git's configuration.

--man
    Show help in the manual page format (this is the default behavior). Uses the system's `man` viewer.

--info
    Show help in the GNU info format. This requires an `info` viewer to be installed and configured.

--external
    Look for external help commands or documentation. This is useful for third-party Git tools or scripts.

--verbose
    Display more detailed information, especially when listing aliases, showing their full command definitions.

--aliases
    List all configured Git aliases and their corresponding command definitions, similar to `git config --get-regexp alias`.

--config
    List all configured Git variables, similar to `git config --list`. Provides a quick overview of the current Git setup.

<command>
    The name of a Git command (e.g., `clone`, `status`, `commit`) for which to display the manual page.

<guide>
    The name of a Git conceptual guide (e.g., `revisions`, `everyday`, `tutorial`) for which to display the documentation.

-g, --guides
    List all available Git conceptual guides. This provides an overview of the various topics covered in Git's documentation.

-a, --all
    List all available Git commands and conceptual guides. This is a comprehensive list of all documentation accessible via `git help`.

--no-strict-enum-validation
    An internal option primarily used for development and testing; generally not intended for direct user interaction.

DESCRIPTION

The `git-help` command is the underlying mechanism that powers the `git help` interface, providing comprehensive access to Git's extensive documentation system. It serves as the primary gateway for users to understand Git commands, conceptual guides, and various aspects of the Git version control system. By default, it displays information via `man` pages, offering a terminal-based, paginated view. However, it also supports displaying documentation in a web browser for a more interactive experience or as GNU `info` pages. Users can query specific command manuals like `git help clone`, delve into conceptual guides such as `git help everyday`, or list all available commands and guides. This command is crucial for learning and referencing Git's extensive functionalities, making it an indispensable tool for both beginners and experienced users navigating the complexities of Git.

CAVEATS

The specific viewer used for displaying documentation (e.g., `less` for `man` pages, a web browser for `--web`) is determined by system environment variables (like `PAGER`, `BROWSER`, `MANPAGER`, `INFOPAGER`) and Git's internal configuration (`help.format`, `help.browser`, `man.viewer`, `info.viewer`). Ensuring these are correctly set is important for the desired display behavior. Web help requires a compatible web browser to be installed and accessible to the system.

CONFIGURATION

The behavior of `git help` can be extensively customized through Git's configuration system. Variables like help.format (e.g., `man`, `web`, `info`), help.browser, man.viewer, and info.viewer allow users to define their preferred methods and tools for displaying documentation. These settings provide flexibility to adapt the help system to individual workflows and environments.

EXTENSIBILITY

Git's help system is designed to be extensible. Users can integrate documentation for their own custom Git commands or scripts by configuring Git's `man-pages.path` or `info.path` variables. This allows external tools to seamlessly become part of the `git help` framework, providing a unified documentation experience for all Git-related functionalities.

HISTORY

The `git help` command (and its underlying `git-help` executable) has been a fundamental component of Git since its early iterations, designed to provide an integrated and consistent means of accessing documentation. Its evolution has focused on enhancing the accessibility and presentation of information, progressively adding options like `--web` for browser-based viewing and improving its ability to list all commands and conceptual guides. This continuous development reflects Git's commitment to being a self-documenting system, ensuring that users can always find necessary information directly from the command line interface.

SEE ALSO

git(1), git-config(1), man(1), info(1)

Copied to clipboard