From: Dragan Simic <dsimic@manjaro.org>
To: "Rubén Justo" <rjusto@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] branch: rework the descriptions of rename and copy operations
Date: Sun, 18 Feb 2024 21:38:54 +0100 [thread overview]
Message-ID: <be91f3ad9305366c1385c2da4881537e@manjaro.org> (raw)
In-Reply-To: <c00f6efe-d1f4-4f2c-99cc-ac7a6d93c9ff@gmail.com>
Hello Ruben,
On 2024-02-17 15:58, Rubén Justo wrote:
> On 16-feb-2024 04:32:10, Dragan Simic wrote:
>> Here's what I think the example from above should eventually look
>> like:
>>
>> 'git branch' (--set-upstream-to=<upstream> | -u <upstream>)
>> [<name>]
>> 'git branch' --unset-upstream [<name>]
>
> Well, my point was not about new terms in this series, but to see if
> the
> idea of reusing an existing one might be of interest.
Good point, ensuring such consistency would be really good.
> I find it interesting to have common terms like "<commit>" "<path>",
> "<envvar>"...
... or "<branch>". :)
> This builds intuition in the user, making it easier to grasp the
> meaning
> of a term, which refers to a similar /thing/, regardless of being used
> in different contexts. And in turn, it can also help to better
> understand the context.
Agreed, consistency is good.
> Side note: My gut tells me that my patch 5aea3955bc (branch:
> clarify <oldbranch> term, 2024-01-06) which was originated by a
> report [1] of a user who found the documentation confusing, would
> have been less likely to happen (the report and consequently my
> patch) if "<branchname>" had been used instead of "<oldbranch>" in
> the documentation. Not because "<branchname>" is a better name,
> but because it is already being used in other commands with a
> clearer meaning of: "if not specified it defaults to the current
> branch". And because of that a user might have be able to fill
> the
> gaps in -m|-c. Of course this is based on my intuition, which I
> know is seriously biased.
>
> [1]
> https://lore.kernel.org/git/pull.1613.git.git.1701303891791.gitgitgadget@gmail.com/
After thinking a bit more about the whole thing, I think that using
"<branch>" instead of "<name>" or "<branchname>" would be our best
choice. It would be simple, direct and clear.
Regarding the branch copy and rename operations and their argument
names, perhaps the following would be a good choice:
--copy [<branch>] <destination>
--move [<branch>] <destination>
It would clearly reflect the nature of the performed operations, while
still using "<branch>" consistently, this time to refer to the source
branch. Using "<destination>" to select the destination name should
be pretty much self-descriptive, if you agree.
Of course, I'll get back to this later in this message.
> And not only can it be of help to the user, but also to developers (or
> reviewers) when documenting new commands or options; because there is
> no need to search for a, maybe new, name if there is one that is
> consolidated.
>
> Perhaps, less names can also improve the lives of translators by making
> it easier to reuse some of the translations.
Perhaps. That should be another example of the long-term benefits
achieved through improved consistency.
>> 'git branch' (-m | -M) [<old>] <new>
>> 'git branch' (-c | -C) [<old>] <new>
>> 'git branch' (-d | -D) [-r] <name>...
>> 'git branch' --edit-description [<name>]
>
> So, to your proposal: it does not make things worse, and it reuses
> terms that are already used elsewhere:
>
> $ for a in '<new>' '<old>' '<name>'; do echo $a $(git grep
> --no-line-number -E "$a" v2.44.0-rc1 -- Documentation/git-*.txt | wc
> -l); done
> <new> 7
> <old> 7
> <name> 147
>
> But based on the idea I've just described, IMHO the user might not
> easily find the similarities in <old> with <name>:
I agree after thinking about the whole thing a bit more.
> And it won't be easy either with <name> and other man pages. For
> example we have:
>
> $ git grep -E 'git checkout.*(new-)?branch'
> Documentation/git-checkout.txt
> Documentation/git-checkout.txt:'git checkout' [-q] [-f] [-m]
> [<branch>]
> Documentation/git-checkout.txt:'git checkout' [-q] [-f] [-m] --detach
> [<branch>]
> Documentation/git-checkout.txt:'git checkout' [-q] [-f] [-m]
> [[-b|-B|--orphan] <new-branch>] [<start-point>]
> Documentation/git-checkout.txt:'git checkout' [<branch>]::
> Documentation/git-checkout.txt:$ git checkout -b <branch> --track
> <remote>/<branch>
> Documentation/git-checkout.txt:'git checkout' -b|-B <new-branch>
> [<start-point>]::
> Documentation/git-checkout.txt:$ git checkout <branch>
> Documentation/git-checkout.txt:'git checkout' --detach [<branch>]::
> Documentation/git-checkout.txt: "git branch" with "-f" followed
> by "git checkout" of that branch;
> Documentation/git-checkout.txt:$ git checkout -b <branch> --track
> <remote>/<branch>
I'd say this solidifies "<branch>" as, hopefully, our best choice,
as already proposed above.
> On the names chosen, the risk of bikesheeding is high and there is
> nothing wrong here, so it is way better to let you work. You have
> taken
> the initiative from Junios's response to my patch, so thank you for
> that.
I hope we'll eventually produce a great git-branch(1) man page together.
After that's completed, I have some more plans for improving git-branch,
by introducing some additional operations.
>> > We don't say that "--edit-description" defaults to the current branch;
>> > It is assumed. Perhaps we can take advantage of that assumption in
>> > -m|-c too.
>>
>> We don't say that yet, :)
>
> Yeah, but maybe we can do it without writing it down :)
Maybe, :) but again, spending a few additional words to describe that
might actually be beneficial. We'll see how it goes.
next prev parent reply other threads:[~2024-02-18 20:39 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 18:42 [PATCH] branch: rework the descriptions of rename and copy operations Dragan Simic
2024-02-15 19:28 ` Kristoffer Haugsbakk
2024-02-15 19:47 ` Dragan Simic
2024-02-15 20:41 ` Junio C Hamano
2024-02-15 21:00 ` Dragan Simic
2024-02-15 21:52 ` Rubén Justo
2024-02-15 22:13 ` Junio C Hamano
2024-02-15 23:34 ` Rubén Justo
2024-02-16 3:32 ` Dragan Simic
2024-02-17 14:58 ` Rubén Justo
2024-02-18 20:38 ` Dragan Simic [this message]
2024-02-19 19:49 ` Junio C Hamano
2024-02-19 19:55 ` Dragan Simic
2024-02-20 18:24 ` Junio C Hamano
2024-02-20 19:12 ` Rubén Justo
2024-02-20 19:49 ` Dragan Simic
2024-02-20 20:25 ` [PATCH] branch: adjust documentation Rubén Justo
2024-02-20 20:34 ` Dragan Simic
2024-02-28 2:19 ` Dragan Simic
2024-02-28 17:20 ` Junio C Hamano
2024-02-28 17:24 ` Junio C Hamano
2024-02-29 1:56 ` Dragan Simic
2024-02-29 18:56 ` Rubén Justo
2024-02-29 19:33 ` Junio C Hamano
2024-02-29 20:02 ` Rubén Justo
2024-02-29 20:09 ` Dragan Simic
2024-03-02 16:18 ` Rubén Justo
2024-02-20 19:32 ` [PATCH] branch: rework the descriptions of rename and copy operations Dragan Simic
2024-02-20 19:14 ` Rubén Justo
2024-02-20 19:56 ` Dragan Simic
2024-02-15 22:27 ` Dragan Simic
2024-02-15 23:38 ` Rubén Justo
2024-02-15 22:31 ` Kyle Lippincott
2024-02-15 22:38 ` Dragan Simic
2024-02-15 22:56 ` Kyle Lippincott
2024-02-15 23:09 ` Dragan Simic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=be91f3ad9305366c1385c2da4881537e@manjaro.org \
--to=dsimic@manjaro.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rjusto@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).