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 15, 2024, 21:52 UTC
Message-ID
<e8fdd057-2670-4c93-b362-202a339d5f49@gmail.com>
In-Reply-To
<3cbc78bb5729f304b30bf37a18d1762af553aa00.1708022441.git.dsimic@manjaro.org>
On 15-feb-2024 19:42:32, Dragan Simic wrote:
> Move the descriptions of the <oldbranch> and <newbranch> arguments to the
> descriptions of the branch rename and copy operations, where they naturally
> belong.
Thank you Dragan for working on this.

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.

Show 108 quoted lines
> Also, improve the descriptions of these two branch operations and,
> for completeness, describe the outcomes of forced operations.
> 
> Describing the arguments together with their respective operations, instead
> of describing them separately in a rather unfortunate attempt to squeeze more
> meaning out of fewer words, flows much better and makes the git-branch(1)
> man page significantly more usable.
> 
> The subsequent improvements shall continue this approach by either dissolving
> as many sentences from the "Description" section into the "Options" section,
> or by having those sentences converted into some kind of more readable and
> better flowing prose, as already discussed and outlined. [1][2]
> 
> [1] https://lore.kernel.org/git/xmqqttmmlahf.fsf@gitster.g/T/#u
> [2] https://lore.kernel.org/git/xmqq8r4zln08.fsf@gitster.g/T/#u
> 
> Signed-off-by: Dragan Simic <dsimic@manjaro.org>
> ---
> 
> Notes:
>     This patch was originally named "branch: clarify <oldbranch> and <newbranch>
>     terms further", submitted and discussed in another thread, [3] but the nature
>     of the patch has changed, causing the patch subject to be adjusted to match.
>     
>     Consequently, this is effectively version 2 of the patch, which includes
>     detailed feedback from Kyle and Junio, who suggested moving/adding the
>     argument descriptions to their respective commands.  This resulted in more
>     significant changes to the contents of the git-branch(1) man page, in an
>     attempt to make it more readable.
>     
>     [3] https://lore.kernel.org/git/e2eb777bca8ffeec42bdd684837d28dd52cfc9c3.1707136999.git.dsimic@manjaro.org/T/#u
> 
>  Documentation/git-branch.txt | 44 +++++++++++++++---------------------
>  1 file changed, 18 insertions(+), 26 deletions(-)
> 
> diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
> index 0b0844293235..370ea43c0380 100644
> --- a/Documentation/git-branch.txt
> +++ b/Documentation/git-branch.txt
> @@ -72,16 +72,6 @@ the remote-tracking branch. This behavior may be changed via the global
>  overridden by using the `--track` and `--no-track` options, and
>  changed later using `git branch --set-upstream-to`.
>  
> -With a `-m` or `-M` option, <oldbranch> will be renamed to <newbranch>.
> -If <oldbranch> had a corresponding reflog, it is renamed to match
> -<newbranch>, and a reflog entry is created to remember the branch
> -renaming. If <newbranch> exists, -M must be used to force the rename
> -to happen.
> -
> -The `-c` and `-C` options have the exact same semantics as `-m` and
> -`-M`, except instead of the branch being renamed, it will be copied to a
> -new name, along with its config and reflog.
> -
>  With a `-d` or `-D` option, `<branchname>` will be deleted.  You may
>  specify more than one branch for deletion.  If the branch currently
>  has a reflog then the reflog will also be deleted.
> @@ -128,18 +118,28 @@ Note that 'git branch -f <branchname> [<start-point>]', even with '-f',
>  refuses to change an existing branch `<branchname>` that is checked out
>  in another worktree linked to the same repository.
>  
> --m::
> ---move::
> -	Move/rename a branch, together with its config and reflog.
> +-m [<oldbranch>] <newbranch>::
> +--move [<oldbranch>] <newbranch>::
> +	Rename an existing branch <oldbranch>, which if not specified defaults
> +	to the current branch, to <newbranch>.  The configuration variables
> +	for the <oldbranch> branch and its reflog are also renamed appropriately
> +	to be used with <newbranch>.  Renaming fails if branch <newbranch>
> +	already exists, but you can use `-M` or `--move --force` to overwrite
> +	the files in existing branch <newbranch> while renaming.
>  
> --M::
> +-M [<oldbranch>] <newbranch>::
>  	Shortcut for `--move --force`.
>  
> --c::
> ---copy::
> -	Copy a branch, together with its config and reflog.
> +-c [<oldbranch>] <newbranch>::
> +--copy [<oldbranch>] <newbranch>::
> +	Copy an existing branch <oldbranch>, which if not specified defaults
> +	to the current branch, to <newbranch>.  The configuration variables
> +	for the <oldbranch> branch and its reflog are also copied appropriately
> +	to be used with <newbranch>.  Copying fails if branch <newbranch>
> +	already exists, but you can use `-C` or `--copy --force` to overwrite
> +	the files in existing branch <newbranch> while copying.
>  
> --C::
> +-C [<oldbranch>] <newbranch>::
>  	Shortcut for `--copy --force`.
>  
>  --color[=<when>]::
> @@ -311,14 +311,6 @@ superproject's "origin/main", but tracks the submodule's "origin/main".
>  	given as a branch name, a commit-id, or a tag.  If this
>  	option is omitted, the current HEAD will be used instead.
>  
> -<oldbranch>::
> -	The name of an existing branch.  If this option is omitted,
> -	the name of the current branch will be used instead.
> -
> -<newbranch>::
> -	The new name for an existing branch. The same restrictions as for
> -	<branchname> apply.
> -
>  --sort=<key>::
>  	Sort based on the key given. Prefix `-` to sort in descending
>  	order of the value. You may use the --sort=<key> option
Previous: Dragan SimicNext: Junio C Hamano
Message 6 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.