git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kyle Lippincott <spectral@google.com>
To: Dragan Simic <dsimic@manjaro.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] branch: rework the descriptions of rename and copy operations
Date: Thu, 15 Feb 2024 14:31:31 -0800	[thread overview]
Message-ID: <CAO_smVioz0izmunDRyHjU_7GGz-_Om_6AVw2CZGFyb4ZF8yedg@mail.gmail.com> (raw)
In-Reply-To: <3cbc78bb5729f304b30bf37a18d1762af553aa00.1708022441.git.dsimic@manjaro.org>

On Thu, Feb 15, 2024 at 10:43 AM Dragan Simic <dsimic@manjaro.org> wrote:
>
> Move the descriptions of the <oldbranch> and <newbranch> arguments to the
> descriptions of the branch rename and copy operations, where they naturally
> belong.  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(-)

Thanks! I think this is a great improvement to this document.

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

Very minor nit: the prevailing style in this document appears to be to
have a single space after the period, but it's definitely
inconsistent. I don't see anything in Documentation/CodingGuidelines
suggesting one way or the other, so don't consider this comment as
blocking, just informational. If we want to achieve (eventual)
consistency, we may want to use a single space after the period now.

> +       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
>

  parent reply	other threads:[~2024-02-15 22:31 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
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 [this message]
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=CAO_smVioz0izmunDRyHjU_7GGz-_Om_6AVw2CZGFyb4ZF8yedg@mail.gmail.com \
    --to=spectral@google.com \
    --cc=dsimic@manjaro.org \
    --cc=git@vger.kernel.org \
    /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).