public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: "Omri Sarig via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "D. Ben Knoble" <ben.knoble@gmail.com>,
	Omri Sarig <omri.sarig13@gmail.com>,
	Omri Sarig <omri.sarig13@gmail.com>
Subject: [PATCH v4] doc: add information regarding external commands
Date: Wed, 04 Mar 2026 15:03:34 +0000	[thread overview]
Message-ID: <pull.2220.v4.git.git.1772636614850.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2220.v3.git.git.1772559813151.gitgitgadget@gmail.com>

From: Omri Sarig <omri.sarig13@gmail.com>

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>
---
    doc: Add information regarding external commands
    
     * Patchset V2 have spaces instead of tabs in one of the lines, it is
       fixed in patchset V3.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2220%2Fomrisarig13%2Fexternal-commands-documentation-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2220/omrisarig13/external-commands-documentation-v4
Pull-Request: https://github.com/git/git/pull/2220

Range-diff vs v3:

 1:  f90ad791d5 ! 1:  516ad65d8d doc: add information regarding external commands
     @@ Commit message
      
          This feature was not fully documented in Git's user-facing
          documentation.
     -    This commit adds a short documentation of this feature, making it easier
     -    for users to discover and use.
     +
     +    Add a short documentation to describe how PATH is used to find a custom
     +    subcommand.
      
          Signed-off-by: Omri Sarig <omri.sarig13@gmail.com>
      
     @@ Documentation/git.adoc: System
      +	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 runnable program. These commands precedes
     -+	alias expansion.
     ++	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
       ~~~~~~~~~~~~~~~~~~


 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 <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

base-commit: 2cc71917514657b93014134350864f4849edfc83
-- 
gitgitgadget

      parent reply	other threads:[~2026-03-04 15:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 19:31 [PATCH] doc: add information regarding external commands Omri Sarig via GitGitGadget
2026-03-02 22:56 ` Junio C Hamano
2026-03-03 17:07   ` Omri Sarig
2026-03-03 17:12 ` [PATCH v2] " Omri Sarig via GitGitGadget
2026-03-03 17:43   ` [PATCH v3] " Omri Sarig via GitGitGadget
2026-03-03 18:40     ` Junio C Hamano
2026-03-03 18:48       ` D. Ben Knoble
2026-03-03 20:11       ` Omri Sarig
2026-03-03 20:36         ` Junio C Hamano
2026-03-04 15:03     ` Omri Sarig via GitGitGadget [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.2220.v4.git.git.1772636614850.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=omri.sarig13@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox