public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] doc: add information regarding external commands
@ 2026-03-02 19:31 Omri Sarig via GitGitGadget
  2026-03-02 22:56 ` Junio C Hamano
  2026-03-03 17:12 ` [PATCH v2] " Omri Sarig via GitGitGadget
  0 siblings, 2 replies; 10+ messages in thread
From: Omri Sarig via GitGitGadget @ 2026-03-02 19:31 UTC (permalink / raw)
  To: git; +Cc: Omri Sarig, Omri Sarig

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 documented in any of Git's user-facing
documentation.
This commit adds a short documentation of this feature, making it easier
for users to discover and use.

Signed-off-by: Omri Sarig <omri.sarig13@gmail.com>
---
    doc: Add information regarding external commands

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

 Documentation/git.adoc | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index ce099e78b8..da7c1329da 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -345,6 +345,24 @@ users typically do not use them directly.
 
 include::{build_dir}/cmds-purehelpers.adoc[]
 
+External commands
+-----------------
+
+In addition to the commands implemented by Git, Git will execute any executable
+with the prefix "git-" in the user path as if it is a Git command.
+
+All parameters of the invocation are passed to the script, making running "git
+foo arg1 arg2" equivalent to running "git-foo arg1 arg2".  When running "git
+help" with the command name, Git will invoke the man page for the given
+command, making running "git help foo" equivalent to running "man git-foo".
+
+This makes it possible to extend Git with custom commands, without the need to
+change its source code.
+
+Git looks for external commands after looking for built-in commands, but before
+looking for aliases. Therefore, if an external command have the same name as an
+alias, it'll run instead of the alias.
+
 Guides
 ------
 

base-commit: 2cc71917514657b93014134350864f4849edfc83
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-03-04 15:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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     ` [PATCH v4] " Omri Sarig via GitGitGadget

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox