Re: [PATCH v2 2/2] branch: add a no-prefix option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 27, 2026, 17:07 UTC
- Message-ID
- <xmqqtsv2ru72.fsf@gitster.g>
- In-Reply-To
- <0fbdf031cb9f054e023d44fd3eb3315732d527c0.1772207333.git.gitgitgadget@gmail.com>
"VALERI Yoann via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 6 quoted lines
> From: VALERI Yoann <yoann.valeri@cea.fr> > > This patch adds a '--no-prefix' option to 'git branch' to selectively > override the 'branch.addCurrentBranchAsPrefix' configuration parameter. > Signed-off-by: VALERI Yoann <yoann.valeri@cea.fr> > ---
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.