git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] branch: rework the descriptions of rename and copy operations

From
Rubén Justo <rjusto@gmail.com>
Date
Feb 17, 2024, 14:58 UTC
Message-ID
<c00f6efe-d1f4-4f2c-99cc-ac7a6d93c9ff@gmail.com>
In-Reply-To
<ea15a49aed7b5a74cd9b1bf8a5351df9@manjaro.org>
On 16-feb-2024 04:32:10, Dragan Simic wrote:
Show 38 quoted lines
> On 2024-02-16 00:34, Rubén Justo wrote:
> > On 15-feb-2024 14:13:31, Junio C Hamano wrote:
> > > Rubén Justo <rjusto@gmail.com> writes:
> > > > On 15-feb-2024 19:42:32, Dragan Simic wrote:
> > > > Let me chime in just to say that maybe another terms could be
> > > > considered
> > > > here;  like: "<branchname>" and "<newbranchname>" (maybe too
> > > > long...) or
> > > > so.
> > > > 
> > > > I have no problem with the current terms, but "<branchname>" can be a
> > > > sensible choice here as it is already being used for other commands
> > > > where, and this may help overall, the consideration: "if ommited, the
> > > > current branch is considered" also applies.
> > > 
> > > Actually, we should go in the opposite direction.  When the use of
> > > names are localized in a narrower context, they can be shortened
> > > without losing clarity.
> > 
> > I did not mean to have longer terms, sorry for that.
> > 
> > I was thinking more in the synopsis:
> > 
> >     'git branch' (--set-upstream-to=<upstream> | -u <upstream>)
> > [<branchname>]
> >     'git branch' --unset-upstream [<branchname>]
> >     'git branch' (-m | -M) [<branchname>] <new>
> >     'git branch' (-c | -C) [<branchname>] <new>
> >     'git branch' (-d | -D) [-r] <branchname>...
> >     'git branch' --edit-description [<branchname>]
> > 
> > To have more uniformity in the terms, which can be beneficial to the
> > user.
> 
> 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.

I find it interesting to have common terms like "<commit>" "<path>", "<envvar>"...

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.

     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/

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.

As I write, I realise that all this probably belongs to CodingGuideLines or similar. Or maybe it is too academic to be practical. I Dunno.

>      '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>:

>      'git branch' (-c | -C) [<old>] <new>
>      'git branch' (-d | -D) [-r] <name>...
At least, not better than with <oldbranch> and <branchname>.

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>

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.

Show 8 quoted lines
> Though, it's something to be left for future patches, which will move
> more argument descriptions to the respective command descriptions.
> 
> > 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 :)
Show 6 quoted lines
> because the description of the command for
> editing branch descriptions is detached from the description of its
> arguments.  The plan is to move all of them together.
> 
> > Of course, there is no need (perhaps counterproductive) to say "branch"
> > if the context makes it clear it is referring to a branch.
Previous: Dragan SimicNext: Dragan Simic
Message 10 of 36 in “branch: rework the descriptions of rename and copy operations”
  1. branch: rework the descriptions of rename and copy operationsDragan Simic, Feb 15, 2024
  2. Kristoffer HaugsbakkFeb 15, 2024
  3. Dragan SimicFeb 15, 2024
  4. Junio C HamanoFeb 15, 2024
  5. Dragan SimicFeb 15, 2024
  6. Rubén JustoFeb 15, 2024
  7. Junio C HamanoFeb 15, 2024
  8. Rubén JustoFeb 15, 2024
  9. Dragan SimicFeb 16, 2024
  10. Rubén JustoFeb 17, 2024
  11. Dragan SimicFeb 18, 2024
  12. Junio C HamanoFeb 19, 2024
  13. Dragan SimicFeb 19, 2024
  14. Junio C HamanoFeb 20, 2024
  15. Rubén JustoFeb 20, 2024
  16. Dragan SimicFeb 20, 2024
  17. branch: adjust documentationRubén Justo, Feb 20, 2024
  18. Dragan SimicFeb 20, 2024
  19. Dragan SimicFeb 28, 2024
  20. Junio C HamanoFeb 28, 2024
  21. Junio C HamanoFeb 28, 2024
  22. Dragan SimicFeb 29, 2024
  23. Rubén JustoFeb 29, 2024
  24. Junio C HamanoFeb 29, 2024
  25. Rubén JustoFeb 29, 2024
  26. Dragan SimicFeb 29, 2024
  27. Rubén JustoMar 2, 2024
  28. Dragan SimicFeb 20, 2024
  29. Rubén JustoFeb 20, 2024
  30. Dragan SimicFeb 20, 2024
  31. Dragan SimicFeb 15, 2024
  32. Rubén JustoFeb 15, 2024
  33. Kyle LippincottFeb 15, 2024
  34. Dragan SimicFeb 15, 2024
  35. Kyle LippincottFeb 15, 2024
  36. Dragan SimicFeb 15, 2024

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.