]> git.ipfire.org Git - thirdparty/git.git/commitdiff
doc: add information regarding external commands
authorOmri Sarig <omri.sarig13@gmail.com>
Wed, 4 Mar 2026 15:03:34 +0000 (15:03 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Mar 2026 17:21:22 +0000 (09:21 -0800)
Git supports running external commands in the user's PATH as if they
were built-in commands (see execv_dashed_external in git.c).

This feature was not fully documented in Git's user-facing
documentation.

Add a short documentation to describe how PATH is used to find a custom
subcommand.

Signed-off-by: Omri Sarig <omri.sarig13@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git.adoc

index ce099e78b8023e90353ffda4fae43a5469fad2b9..9c2a8978c704309d8d13a3b7156d70453d3f3b4c 100644 (file)
@@ -487,6 +487,14 @@ System
        `$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;
        otherwise `$USERPROFILE` if `$USERPROFILE` exists.
 
+`PATH`::
+       When a user runs 'git <command>' that is not part of the core Git programs
+       (installed in GIT_EXEC_PATH), 'git-<command>' that is runnable by the user
+       in a directory on `$PATH` is invoked. Argument passed after the command
+       name are passed as-is to the program. To execute `git <foo>`, `git` finds
+       command `<foo>` (either a core Git program found in 'GIT_EXEC_PATH', or a
+       custom one in a directory on 'PATH'), before trying `foo` as an alias.
+
 The Git Repository
 ~~~~~~~~~~~~~~~~~~
 These environment variables apply to 'all' core Git commands. Nb: it