Re: [PATCH 3/3] init: provide useful advice about init.defaultBranch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

>> 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.
>
> Good point.
>
>> 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.
>
> Also a good point.

> I came up with this, which I intend to submit with v2:
>
> 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 initial branch name to use in all of your\n"
> "new repositories (or to suppress this warning), run:\n"

The same issue around "to suppress" is here, though.

> "\n"
> "\tgit config --global init.defaultBranch <name>\n"
> "\n"
> "Common names are 'main', 'trunk' and 'development'. The initial branch\n"
> "can be renamed via this command:\n"
> "\n"
> "\tgit branch -m <name>\n"

It is very likely that the users are on an unborn branch when they
see this message and "git branch -m/-M <name>" does not work.  We'd
probably want to update "git branch" to allow renaming the current
branch that is unborn.

In the meantime, you could do "git checkout --orphan <name>" here,
but once <name> exists as a branch that would not work, so...


> );
>
> Ciao,
> Dscho



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux