Re: [PATCH 3/3] init: provide useful advice about init.defaultBranch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 23, 2020, 02:07 UTC
- Message-ID
- <xmqq4klgq10d.fsf@gitster.c.googlers.com>
- In-Reply-To
- <xmqqft51osnu.fsf@gitster.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
>> +static const char default_branch_name_advice[] = N_( >> +"Using '%s' as the name for the initial branch. This name is subject\n" >> +"to change. To configure the name to use as the initial branch name in\n" >> +"new repositories, or to silence this warning, run:\n" > > s/new repositories/all of your new repositories/ as that is the > whole point of using --global option below. > >> +"\n" >> +"\tgit config --global init.defaultBranch <name>\n" >> +); >> +
The above may give a valuable lesson to those who want to use one branch name across new repositories, but it does not tell those who wanted 'trunk' (to match the project, perhaps github.com/cli/cli, with which they intend to interact) how to recover from having already created the 'master' branch. We may want to add some text to suggest "branch -M" after giving the advice for the permanent option.
Also, it is unclear to those who do not have a good <name> in mind (or, those who do not care to choose a <name> for themselves), what <name> they should give to take the "or to silence this warning" part of the advice. It probably is a good idea to rephrase and say either:
... To configure ... in all your new repositories and squelch
this message, run:git config --global init.defaultBranch <name>
or
... To configure ... in all your new repositories, run:
git config --global init.defaultBranch <name>
Note that this message won't appear after doing so.
I am offhand not sure which one is better.
Thanks.