From 9c6569a8951d01363ec1e866a3b0711dbcaedcef Mon Sep 17 00:00:00 2001 From: Omri Sarig Date: Wed, 4 Mar 2026 15:03:34 +0000 Subject: [PATCH] doc: add information regarding external commands 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 Signed-off-by: Junio C Hamano --- Documentation/git.adoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/git.adoc b/Documentation/git.adoc index ce099e78b8..9c2a8978c7 100644 --- a/Documentation/git.adoc +++ b/Documentation/git.adoc @@ -487,6 +487,14 @@ System `$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist; otherwise `$USERPROFILE` if `$USERPROFILE` exists. +`PATH`:: + When a user runs 'git ' that is not part of the core Git programs + (installed in GIT_EXEC_PATH), 'git-' 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 `, `git` finds + command `` (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