Subject: Re: [PATCH v2 2/2] branch: add a no-prefix option

From: Junio C Hamano <[email-masked]>
Date: Fri, 27 Feb 2026 09:07:45 -0800

"VALERI Yoann via GitGitGadget" <[email-masked]> writes:

> From: VALERI Yoann <[email-masked]>
>
> This patch adds a '--no-prefix' option to 'git branch' to selectively
> override the 'branch.addCurrentBranchAsPrefix' configuration parameter.
> Signed-off-by: VALERI Yoann <[email-masked]>
> ---

That is unusual in multiple ways.

The usual way to do so is to give a command line option that is
usable without needing any configuration.  This happens first in
early patches in a series.

And then, assuming that the command line option is widely supported
as useful (but cumbersome to specify every time), help the users by
adding a configuration variable, that can be overridden via the
command line option.  That happens next in later patches in a
series.

And in order to help users discover these two features more easily,
it is customery to give them very similar names.  In other words,
adding "--[no-]prefix-current-branch-name" may be more
understandable if it is added in patch [1/2], if we want to make the
matching configuration "branch.addCurrentBranchAsPrefix" in patch
[2/2].

Even better, have you considered leaving the door open for _others_
to come up with better ideas _later_ by making it extensible, e.g.,

    --no-name-prefix
    --name-prefix=<token>

where the initial implementation the only supported <token> is
"current" (to signal "current branch name")?  That would mean that
the corresponding configuration variable would also be a string, not
a boolean, e.g., "branch.namePrefix = current".

Perhaps those who work with more than one remotes want to give their
branches meant to be pushed to remote A with prefix A- while naming
the branches meant to be pushed to remote B with prefix B-, or
something, that is not based on the current branch but something
else (e.g., @{push} in this hypothetical example).  I am not saying
that you should add such a support to the feature in this series
(quite honestly, I am not convinced at all if prefixing with the
current branch name is even something worth adding myself), but we
do not want to end up with millions of branch.add${Foo}AsPrefix with
different values of ${Foo} when we discover that such prefixing
scheme is useful in the future.

Thanks.