Subject: Re: [PATCH v4 2/2] branch: add 'branch.namePrefix' config param

From: Junio C Hamano <[email-masked]>
Date: Thu, 09 Apr 2026 12:52:14 -0700

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

> +`branch.namePrefix`::
> +	When a new branch is created with `git branch`, use the provided value as
> +	prefix for its name. Can be '@{current}' to use the current branch's name
> +	as prefix. This value can be overriden by using the '--[no-]name-prefix'
> +	option of `git branch`.

Even after reading the cover letter, I am not convinced why this is
a good idea in the first place.

Also, I am not sure if "current branch" really captures what you are
trying to achieve.  When "git branch foo" creates a new branch "foo"
out of _the_ _current_ branch, i.e.

    $ git checkout base
    $ git branch foo

with the nameprefix configuration, it may appear that it is doing
what you want by deriving the name of the new branch taking both
"base" and "foo" into account, but what would you want to happen if
you did this instead:

    $ git checkout base
    $ git branch foo

or while you may be on an unrelated "master" branch, create and
switch to the new branch:

    $ git checkout -b foo base

whose name takes both "base" and "foo" into account.

What I am getting at is that "the current branch" is missing the
point and it may be "the branch the new branch was forked off of"
that is what you really are trying to find that "base" in.

Having said all that, I am fairly negative on this new feature,
simply because it is too much magic and will be confusing,
especially when invoked with a configuration variable.