Re: [PATCH] branch doc: Change `git branch <pattern>` to use `<branchname>`
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 19 quoted lines
>>> --list::
>>> - Activate the list mode. `git branch <pattern>` would try to create a branch,
>>> + Activate the list mode. `git branch <branchname>` would try to create a branch,
>>> use `git branch --list <pattern>` to list matching branches.
>>
>> This makes the description more correct.
>>
>> I am not sure if it makes that much sense to have that sentence here
>> in the first place (after all, it is describing a behaviour of a
>> mode that is *not* the list mode), but I guess that it may be a
>> common mistake to forget to specify "-l" while asking for branches
>> that match the pattern? If we were writing this today from scratch,
>> I would perhaps write something entirely different, e.g.
>
> I'm just doing s/pattern/branchname/ on the existing documentation. If
> you'd like to entirely reword this to make that unnecessary that
> sounds good, but makes sense that you then submit that patch & just
> drop this one, rather than me copy/pasting your proposal, sending that
> as my own patch etc...
That is sensible. I've already queued yours as-is a few hours ago, and the remainder of this message is in preparation for a follow-up patch that is a separate topic.
Show 10 quoted lines
>> --list::
>> List branches. With optional <pattern>... at the
>> end of the command line, list only the branches that
>> match any of the given patterns. Do not forget '-l'
>> and say "git branch <pattern>", as it will instead
>> try to create a new branch whose name is <pattern>,
>> which is a common mistake.
>
> I like the old one better. It has 3 actual command examples you can
> readily see.
Having the _wrong_ example `git branch <branchname>` that is readily available for cutting and pasting is the worst of the three reasons why I think the current text is bad (the other two being "it does not even help in explaining the `--list` option" and "The argument to the other mode is not <pattern> but is <branchname>").
I can go without "Do not forget ..." and everything that follows, though, and if we are going to do so, then
--list::
List branches. With optional <pattern>...,
e.g. `git branch --list 'maint-*`, list only the
branches that match the pattern(s).
would be fine. I am not opposed to having an visually distinctive example--I just do not want to have one that is wrong without clearly marking it as such.