gitmanual

Where does the Git documentation mention that "git-foo" on $PATH can be called as "git foo"?


Git has this feature, where you can place any executable named git-foo on $PATH and then call it as git foo <args>, like a built-in subcommand (or is it more of a side-effect of how Git implemented subcommands in the early days?).

I learned this probably 15 years ago and now told someone about this who didn't know it already. I'd like to point them to some documentation explaining it in a bit more detail (e.g. the variables that are placed in the environment) by git.

Where is this behavior documented in the official documentation (or e.g. in a mail thread by the developers)?


Solution

  • The only place I know of in the documentation is here (git help git, --list-cmds option, emphasis mine) :

    --list-cmds=group[,group…]

    List commands by group.
    This is an internal/experimental option and may change or be removed in the future. Supported groups are: builtins, parseopt (builtin commands that use parse-options), main (all commands in libexec directory), others (all other commands in $PATH that have git- prefix), list-<category> (see categories in command-list.txt), nohelpers (exclude helper commands), alias and config (retrieve command list from config variable completion.commands)