Is it possible to list the options of a Git command from the command line?
I am aware of git help <command>
and git <command> --help
, which provide the full documentation of a command with the complete list of its options. However, they redirect the user to a web page, leaving the command line.
Instead, I would like to know if there is a way to list the options of a command within the command line. I don't need the full documentation; just a list of the possible options will do.
To display the options of a Git command, enter the command followed by a double dash, and then type the TAB
key twice. However, this method will only show the options preceded by a double dash. Single dash options will be excluded.
For example:
git init --<TAB><TAB>
--bare --object-format= --shared
--initial-branch= --quiet --template=
--no-... --ref-format=
--no-template --separate-git-dir=
Instead, to have the full list of options of a Git command, you can type git <command> -h
(thanks @joanis for pointing that out). This will prompt Git to print:
For example:
git init -h
usage: git init [-q | --quiet] [--bare] [--template=<template-directory>]
[--separate-git-dir <git-dir>] [--object-format=<format>]
[--ref-format=<format>]
[-b <branch-name> | --initial-branch=<branch-name>]
[--shared[=<permissions>]] [<directory>]
--[no-]template <template-directory> directory from which templates will be used
--[no-]bare create a bare repository
--shared[=<permissions>] specify that the git repository is to be shared amongst several users
-q, --[no-]quiet be quiet
--[no-]separate-git-dir <gitdir> separate git dir from working tree
-b, --[no-]initial-branch <name> override the name of the initial branch
--[no-]object-format <hash> specify the hash algorithm to use
--[no-]ref-format <format> specify the reference format to use