git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 18:02 UTC

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.
Previous: VALERI Yoann via GitGitGadgetNext: Yoann Valeri via GitGitGadget
Message 7 of 23 in “branch: add 'branch.addCurrentBranchAsPrefix' config param”
  1. branch: add 'branch.addCurrentBranchAsPrefix' config paramYoann Valeri via GitGitGadget, Feb 20, 2026
  2. Junio C HamanoFeb 20, 2026
  3. Junio C HamanoFeb 20, 2026
  4. 0/2 branch: add 'branch.addCurrentBranchAsPrefix' config paramYoann Valeri via GitGitGadget, Feb 27, 2026
  5. 1/2 branch: add 'branch.addCurrentBranchAsPrefix' config paramVALERI Yoann via GitGitGadget, Feb 27, 2026
  6. 2/2 branch: add a no-prefix optionVALERI Yoann via GitGitGadget, Feb 27, 2026
  7. Junio C HamanoFeb 27, 2026
  8. 0/3 branch: add prefixes to new branch namesYoann Valeri via GitGitGadget, Mar 6, 2026
  9. 1/3 branch: add '--name-prefix' optionVALERI Yoann via GitGitGadget, Mar 6, 2026
  10. 2/3 branch: add 'branch.namePrefix' config paramVALERI Yoann via GitGitGadget, Mar 6, 2026
  11. 3/3 branch: add '--no-name-prefix' optionVALERI Yoann via GitGitGadget, Mar 6, 2026
  12. Junio C HamanoMar 6, 2026
  13. Junio C HamanoMar 6, 2026
  14. Eric SunshineMar 7, 2026
  15. Eric SunshineMar 7, 2026
  16. Eric SunshineMar 7, 2026
  17. Junio C HamanoMar 8, 2026
  18. Junio C HamanoMar 8, 2026
  19. 0/2 branch: add prefixes to new branch namesYoann Valeri via GitGitGadget, Apr 9, 2026
  20. 1/2 branch: add '--name-prefix' optionVALERI Yoann via GitGitGadget, Apr 9, 2026
  21. 2/2 branch: add 'branch.namePrefix' config paramVALERI Yoann via GitGitGadget, Apr 9, 2026
  22. Junio C HamanoApr 9, 2026
  23. Junio C HamanoApr 9, 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.