git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] doc: add information regarding external commands

From
Omri Sarig <omri.sarig13@gmail.com>
Date
Mar 3, 2026, 20:11 UTC
Message-ID
<CAP9es6uT4xE2+h6mCXgYVcibutVOah1xKyS8cKaV1u=VHBpLZw@mail.gmail.com>
In-Reply-To
<xmqqh5qwdaeh.fsf@gitster.g>
Thanks for the help!

I fully understand this is something you can just do in a few minutes, so I really appreciate the support and the welcoming attitude.

On Tue, Mar 3, 2026 at 7:40 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
>
> "Omri Sarig via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> Thanks.  Almost there.
>
> The usual way to compose a log message of this project is to
>
>  - Give an observation on how the current system works in the
>    present tense (so no need to say "Currently X is Y", or
>    "Previously X was Y" to describe the state before your change;
>    just "X is Y" is enough), and discuss what you perceive as a
>    problem in it.
>
>  - Propose a solution (optional---often, problem description
>    trivially leads to an obvious solution in reader's minds).
>
>  - Give commands to somebody editing the codebase to "make it so",
>    instead of saying "This commit does X".
>
> in this order.
Understood, I'll fix accordingly.
Show 42 quoted lines
>
> > 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.
>
> Your description of the problem above is excellent.
>
> > This commit adds a short documentation of this feature, making it easier
> > for users to discover and use.
>
> There is nothing incorrect in the above, but we would write it more
> like
>
>     Add a short documentation to describe how PATH is used to find a
>     custom subcommand.
>
> > Signed-off-by: Omri Sarig <omri.sarig13@gmail.com>
>
> > diff --git a/Documentation/git.adoc b/Documentation/git.adoc
> > index ce099e78b8..903d11c530 100644
> > --- a/Documentation/git.adoc
> > +++ b/Documentation/git.adoc
> > @@ -487,6 +487,13 @@ 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
>
> OK.
>
> > +     name are passed as-is to the runnable program. These commands precedes
> > +     alias expansion.
>
> We are not going to try running a program that is not runnable
> anyway, so "the runnable program" -> "the program", probably?
Completely agree, will fix.
> I am not sure what the last sentence wants to say, especially the
> "alias expansion" part.  Do you mean that your "git foo" alias (not
> just its expansion but its presence as a whole) is ignored if you
> have a "git-foo" program on your $PATH?

This is exactly what I tried to write there. Personally, I had expected aliases to take precedence over external commands, so I was surprised to see that it is reversed (so the program "git-foo" runs before Git looks for the alias "git foo"). I thought it'll make sense to mention in the documentation, to save possible headaches for future developers.

I'm not sure it's too much information, or should just be described better?
Maybe adding a second paragraph with something like this can be clearer:
    External commands precedes aliases. For example, running "git foo" will
    execute "git-foo" from PATH; only if "git-foo" does not exist, will Git
    look for the alias "foo".
What do you think?
Show 30 quoted lines
> Speaking of "alias", I have always felt that it was suboptimal to
> make users refer to "git help config" to find out about it.  I
> wonder if "git help git" should be the first place users would look
> for a help about them?
>
> We have "GIT COMMANDS" section in "git help git" that says "We
> divide GIt into porcelain and plumbing" and then have two
> subsections there that list commands that belong to these two
> categories.  Perhaps leaving some breadcrumbs to redirect them would
> be a good start, something like this?
>
>  Documentation/git.adoc | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git c/Documentation/git.adoc w/Documentation/git.adoc
> index ce099e78b8..fb5b477eda 100644
> --- c/Documentation/git.adoc
> +++ w/Documentation/git.adoc
> @@ -235,7 +235,10 @@ GIT COMMANDS
>  ------------
>
>  We divide Git into high level ("porcelain") commands and low level
> -("plumbing") commands.
> +("plumbing") commands.  For defining command aliases, see
> +linkgit:gitconfig[1] and look for descriptions of `alias.*`.
> +For installing custom "git" subcommands, see the description for
> +the 'PATH' environment variable in this manual.
>
>  High-level commands (porcelain)
>  -------------------------------
I agree - that makes good sense to me too.

Do you see it as belonging in the same commit, or in a subsequent commit? I'm not fully clear about the rules for splitting such commits in the repo.

Thanks, With Kind Regards, Omri

Previous: D. Ben KnobleNext: Junio C Hamano
Message 8 of 10 in “doc: add information regarding external commands”
  1. doc: add information regarding external commandsOmri Sarig via GitGitGadget, Mar 2, 2026
  2. Junio C HamanoMar 2, 2026
  3. Omri SarigMar 3, 2026
  4. doc: add information regarding external commandsOmri Sarig via GitGitGadget, Mar 3, 2026
  5. doc: add information regarding external commandsOmri Sarig via GitGitGadget, Mar 3, 2026
  6. Junio C HamanoMar 3, 2026
  7. D. Ben KnobleMar 3, 2026
  8. Omri SarigMar 3, 2026
  9. Junio C HamanoMar 3, 2026
  10. doc: add information regarding external commandsOmri Sarig via GitGitGadget, Mar 4, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.