branch: rework the descriptions of rename and copy operations
PATCH 1/1 branch: rework the descriptions of rename and copy operations
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/[email protected]/T/#u
[2] https://lore.kernel.org/git/[email protected]/T/#u
---
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.
Documentation/git-branch.txt | 44 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 26 deletions(-)
Documentation/git-branch.txt +18 -26
@@ -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
Hey Dragan
(I’m adding some Cc from the previous round)
Quoted 9 lines · Dragan Simic
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.
Excellent.
Quoted 8 lines
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/[email protected]/T/#u
[2] https://lore.kernel.org/git/[email protected]/T/#u
Since this is a one-patch series, it wasn’t clear to me what “subsequent improvements” was referring to without following the links. By following the links it looks like plans have been made to improve this man page further. Maybe the commit message could either state this intent more assertively or commit to it less (like “we might in the future…”)? So that the links become supplementary information instead of seemingly filling in some blanks.
(If I read this part correctly.)
Documentation/git-branch.txt Note that 'git branch -f <branchname> [<start-point>]', even with '-f', · line 124
Quoted 7 lines
--m::
---move::Documentation/git-branch.txt +4
-1- 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
I had to read the first sentence a few times in order to understand what the “which” part was saying (which seems to come from [1] by Junio). How about letting it trail the sentence?
« Rename an existing branch <oldbranch> to <newbranch>, with
<oldbranch> defaulting to the current branch if not specified.
Documentation/git-branch.txt Note that 'git branch -f <branchname> [<start-point>]', even with '-f', · line 128
Quoted 4 lines
Documentation/git-branch.txt +4
-0+ 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.
“the files” refers to the branch configuration and the reflog? People who read the man pages might not know that the reflogs are implemented as files and get tripped up. Maybe “to overwrite” could be left unstated?
Or maybe I just misunderstood this part.
This patch also drops this part. Shouldn’t this be noted?
« , and a reflog entry is created to remember the branch renaming.
Right now it looks like (reads like) the reflog is moved and an entry is not made about it.
Quoted 16 lines
--M::
+-M [<oldbranch>] <newbranch>::Documentation/git-branch.txt +8
-3Shortcut 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.
Hello Kristoffer,
Quoted 1 line · Kristoffer Haugsbakk
(I’m adding some Cc from the previous round)
Thanks, I realised that to be missing like two seconds after sending the patch to the list. :/
Quoted 6 lines · Dragan Simic
Quoted 5 lines
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.
Quoted 6 lines
Quoted 4 lines
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.
Excellent.
Thanks, I'm glad that you like it. :)
Quoted 16 lines
Quoted 7 lines
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/[email protected]/T/#u
[2] https://lore.kernel.org/git/[email protected]/T/#uSince this is a one-patch series, it wasn’t clear to me what “subsequent improvements” was referring to without following the links. By following the links it looks like plans have been made to improve this man page further. Maybe the commit message could either state this intent more assertively or commit to it less (like “we might in the future…”)? So that the links become supplementary information instead of seemingly filling in some blanks.
Quoted 1 line
(If I read this part correctly.)
It refers to the already planned further rework of the git-branch(1) man page, which I intend to follow, but also leaves a TODO note to anyone else looking at the repository history, in case I end up not following the plan for some reason. I hope this makes it more clear.
Quoted 13 lines
Review
Quoted 8 lines
--m::
---move::Documentation/git-branch.txt +3
-1- Move/rename a branch, together with its config and reflog. +-m [<oldbranch>] <newbranch>:: +--move [<oldbranch>] <newbranch>:: + Rename an existing branch <oldbranch>, which if not specifieddefaults
(quoted diff) +1
-0+ to the current branch, to <newbranch>. The configuration variablesI had to read the first sentence a few times in order to understand what the “which” part was saying (which seems to come from [1] by Junio). How about letting it trail the sentence?
Quoted 2 lines
« Rename an existing branch
<oldbranch>to<newbranch>, with
<oldbranch>defaulting to the current branch if not specified.
Makes sense, maybe even something like this for the v2:
Rename an existing branch <oldbranch> to <newbranch>; if not
specified,
<oldbranch> defaults to the current branch.
Quoted 14 lines
🔗 1: https://lore.kernel.org/git/[email protected]/
Documentation/git-branch.txt Note that 'git branch -f <branchname> [<start-point>]', even with '-f', · line 128
Quoted 6 lines
(quoted diff) +1
-0+ for the <oldbranch> branch and its reflog are also renamedappropriately
(quoted diff) +2
-0+ to be used with <newbranch>. Renaming fails if branch <newbranch> + already exists, but you can use `-M` or `--move --force` tooverwrite
Documentation/git-branch.txt +1
-0+ the files in existing branch <newbranch> while renaming.“the files” refers to the branch configuration and the reflog? People who read the man pages might not know that the reflogs are implemented as files and get tripped up. Maybe “to overwrite” could be left unstated?
Quoted 1 line
Or maybe I just misunderstood this part.
Basically, the internal logic just overwrites the files, whatever the files actually are, and issues warning messages about that. Frankly, I'm not sure that having "--force" available is the safest possible thing, but it's already there and needs documenting.
Thus, "the files" refers to just that, the files in the destination branch that pretty much gets garbled after forced operations.
Perhaps it could be worded like this in the v2:
... but you can use -M or --move --force to overwrite the
contents
of the existing branch <newbranch> while renaming.
Quoted 6 lines
This patch also drops this part. Shouldn’t this be noted?
« , and a reflog entry is created to remember the branch renaming.
Right now it looks like (reads like) the reflog is moved and an entry is not made about it.
Good point, thanks. I'll address that in the v2.
Quoted 17 lines
Quoted 17 lines
--M::
+-M [<oldbranch>] <newbranch>::Documentation/git-branch.txt +5
-3Shortcut 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 copiedappropriately
(quoted diff) +2
-0+ to be used with <newbranch>. Copying fails if branch <newbranch> + already exists, but you can use `-C` or `--copy --force` tooverwrite
Documentation/git-branch.txt +1
-0+ the files in existing branch <newbranch> while copying.
Quoted 14 lines · Kristoffer Haugsbakk
(If I read this part correctly.)
Documentation/git-branch.txt Note that 'git branch -f <branchname> [<start-point>]', even with '-f', · line 124
Quoted 7 lines
--m::
---move::Documentation/git-branch.txt +4
-1- 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 variablesI had to read the first sentence a few times in order to understand what the “which” part was saying (which seems to come from [1] by Junio). How about letting it trail the sentence?
Quoted 2 lines
« Rename an existing branch
<oldbranch>to<newbranch>, with
<oldbranch>defaulting to the current branch if not specified.
Yeah, insertion of "if not specified" in the middle made the resulting text unnecessarily hard to follow, and moving it to the end is a fine fix. But I think we can just drop it (in other words, we already said "defaulting to" and that should be sufficient).
Quoted 9 lines
Documentation/git-branch.txt Note that 'git branch -f <branchname> [<start-point>]', even with '-f', · line 128
Quoted 4 lines
Documentation/git-branch.txt +4
-0+ 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.“the files” refers to the branch configuration and the reflog? People who read the man pages might not know that the reflogs are implemented as files and get tripped up. Maybe “to overwrite” could be left unstated?
Yeah, "overwrite the files in existing branch" can be mislead in other ways, including "in a similar way that 'checkout -f <other>' can overwrite the files with local modifications in the working tree with the <other> branch we are switching to". We'd be better off not mentioning files at all [*].
... but you can use ... to clobber an existing <newbranch>.
would be sufficient. If the verb "clobber" is unfamiliar to some readers, "overwrite" is also fine. The most important part from the end-user's point of view is that whatever data associated with the name <newbranch> is now gone, and replaced by what was associated with the name <oldbranch>. How we stored such data associated with each branch is immaterial.
Side note: Especially because we are not married to the files backend that stores one file per branch under .git/logs/refs/heads/ and .git/refs/heads/ directories forever. With reftable backend, there is no such files specific to <newbranch> to be overwritten.
Another thing. The existence of a <newbranch> is not the only case we fail "git branch -m [<oldbranch>] <newbranch>", but the mention of this particular safety valve is to tell readers that forcing with -M is how to override the safety. We want to be absolutely clear that we are not trying to exhaustively enumerate failure modes [*] to our readers, and I am not sure if we succeeded in the proposed text.
Side note: In other words, there are other ways the command can fail, and -M may not be a way to "fix" these failures.
Quoted 6 lines
This patch also drops this part. Shouldn’t this be noted?
« , and a reflog entry is created to remember the branch renaming.
Right now it looks like (reads like) the reflog is moved and an entry is not made about it.
True. This was missing in my "or something like that" illustration and the patch copies without checking the original. It should be resurrected.
Thanks, both for writing and carefully reading. Removal of <newbranch> and <oldbranch> from the OPTIONS enumaration is really good, too.
Hello Junio,
Quoted 16 lines · Junio C Hamano
Quoted 15 lines · Kristoffer Haugsbakk
(If I read this part correctly.)
Review
Quoted 8 lines
--m::
---move::Documentation/git-branch.txt +3
-1- Move/rename a branch, together with its config and reflog. +-m [<oldbranch>] <newbranch>:: +--move [<oldbranch>] <newbranch>:: + Rename an existing branch <oldbranch>, which if not specifieddefaults
(quoted diff) +1
-0+ to the current branch, to <newbranch>. The configuration variablesI had to read the first sentence a few times in order to understand what the “which” part was saying (which seems to come from [1] by Junio). How about letting it trail the sentence?
Quoted 7 lines
Quoted 2 lines
« Rename an existing branch
<oldbranch>to<newbranch>, with
<oldbranch>defaulting to the current branch if not specified.Yeah, insertion of "if not specified" in the middle made the resulting text unnecessarily hard to follow, and moving it to the end is a fine fix. But I think we can just drop it (in other words, we already said "defaulting to" and that should be sufficient).
This is what seems most readable to me:
Rename an existing branch <oldbranch> to <newbranch>; if left unspecified, <oldbranch> defaults to the current branch.
Quoted 27 lines
Quoted 11 lines
Documentation/git-branch.txt Note that 'git branch -f <branchname> [<start-point>]', even with '-f', · line 128
Quoted 6 lines
(quoted diff) +1
-0+ for the <oldbranch> branch and its reflog are also renamedappropriately
(quoted diff) +2
-0+ to be used with <newbranch>. Renaming fails if branch <newbranch> + already exists, but you can use `-M` or `--move --force` tooverwrite
Documentation/git-branch.txt +1
-0+ the files in existing branch <newbranch> while renaming.“the files” refers to the branch configuration and the reflog? People who read the man pages might not know that the reflogs are implemented as files and get tripped up. Maybe “to overwrite” could be left unstated?
Yeah, "overwrite the files in existing branch" can be mislead in other ways, including "in a similar way that 'checkout -f <other>' can overwrite the files with local modifications in the working tree with the <other> branch we are switching to". We'd be better off not mentioning files at all [*].
... but you can use ... to clobber an existing
<newbranch>.would be sufficient. If the verb "clobber" is unfamiliar to some readers, "overwrite" is also fine. The most important part from the end-user's point of view is that whatever data associated with the name <newbranch> is now gone, and replaced by what was associated with the name <oldbranch>. How we stored such data associated with each branch is immaterial.
Quoted 5 lines
Side note: Especially because we are not married to the files backend that stores one file per branch under .git/logs/refs/heads/ and .git/refs/heads/ directories forever. With reftable backend, there is no such files specific to <newbranch> to be overwritten.
To me, using "clobber" actually doesn't make it more clear. How about wording it this way:
Renaming fails if branch <newbranch> already exists, but -M or --move --force can be used to overwrite the contents of the existing branch <newbranch> while renaming.
To me, "overwriting an existing branch" means something like "deleting an existing branch first, before doing anything else". Just like in case of overwriting an existing file, which gets deleted first, which most users are familiar with.
On the other hand, "overwriting the contents of an existing branch", at least to me, means that the branch isn't deleted first, but the new branch is "layered" onto it instead, overwriting some or all of its contents.
Additionally, "its contents" removes the direct link between the files and the branches, which should make the description future proof.
Quoted 13 lines
Another thing. The existence of a <newbranch> is not the only case we fail "git branch -m [<oldbranch>] <newbranch>", but the mention of this particular safety valve is to tell readers that forcing with
-Mis how to override the safety. We want to be absolutely clear that we are not trying to exhaustively enumerate failure modes [*] to our readers, and I am not sure if we succeeded in the proposed text.Side note: In other words, there are other ways the command can fail, and
-Mmay not be a way to "fix" these failures.Quoted 2 lines
This patch also drops this part. Shouldn’t this be noted?
Quoted 8 lines
Quoted 4 lines
« , and a reflog entry is created to remember the branch renaming.
Right now it looks like (reads like) the reflog is moved and an entry is not made about it.
True. This was missing in my "or something like that" illustration and the patch copies without checking the original. It should be resurrected.
Already brought this back for the v2. It was omitted in the v1 by an honest mistake.
Quoted 3 lines
Thanks, both for writing and carefully reading. Removal of <newbranch> and <oldbranch> from the OPTIONS enumaration is really good, too.
I'm glad that you're happy with the improvements so far. :)
Quoted 3 lines · Dragan Simic
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.
Quoted 108 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/[email protected]/T/#u
[2] https://lore.kernel.org/git/[email protected]/T/#uSigned-off-by Dragan Simic <[email protected]>---
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.
Documentation/git-branch.txt | 44 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 26 deletions(-)Documentation/git-branch.txt +18
-26@@ -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
Quoted 8 lines · Rubén Justo
Quoted 3 lines · Dragan Simic
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.
Quoted 8 lines
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. For example:
-m [<old>] <new>:: rename the <old> branch (defaults to the current one) to <new>.
is just as clear as the same description with <oldbranch> and <newbranch>. With the original text without any of the suggested changes, <oldbranch> and <newbranch> appeared very far from the context they are used in (i.e. the description for -m and -c), and it may have helped readers to tell that these are names of branches. But if the context is clear that we are talking about "renaming" branches, there is not as much added benefit to say "branch" in these names as in the current text.
Quoted 14 lines · Junio C Hamano
Quoted 12 lines · Rubén Justo
Quoted 3 lines · Dragan Simic
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.
Quoted 8 lines
Quoted 4 lines
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.
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.
Of course, there is no need (perhaps counterproductive) to say "branch" if the context makes it clear it is referring to a branch.
Quoted 14 lines
For example:
-m [<old>] <new>:: rename the <old> branch (defaults to the current one) to <new>.is just as clear as the same description with <oldbranch> and <newbranch>. With the original text without any of the suggested changes, <oldbranch> and <newbranch> appeared very far from the context they are used in (i.e. the description for -m and -c), and it may have helped readers to tell that these are names of branches. But if the context is clear that we are talking about "renaming" branches, there is not as much added benefit to say "branch" in these names as in the current text.
Quoted 28 lines · Rubén Justo
Quoted 6 lines · Junio C Hamano
Quoted 5 lines · Rubén Justo
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.Quoted 8 lines
Quoted 4 lines
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>]
Quoted 2 lines
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>]
'git branch' (-m | -M) [<old>] <new>
'git branch' (-c | -C) [<old>] <new>
'git branch' (-d | -D) [-r] <name>...
'git branch' --edit-description [<name>]Though, it's something to be left for future patches, which will move more argument descriptions to the respective command descriptions.
Quoted 3 lines
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, :) 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.
Quoted 2 lines
Of course, there is no need (perhaps counterproductive) to say "branch" if the context makes it clear it is referring to a branch.
Quoted 31 lines · Dragan Simic
Quoted 30 lines · Rubén Justo
Quoted 8 lines · Junio C Hamano
Quoted 7 lines · Rubén Justo
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.Quoted 8 lines
Quoted 4 lines
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>]
Quoted 7 lines
Quoted 2 lines
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/[email protected]/
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.
Quoted 4 lines
'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>:
Quoted 2 lines
'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.
Quoted 8 lines
Though, it's something to be left for future patches, which will move more argument descriptions to the respective command descriptions.
Quoted 3 lines
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 :)
Quoted 6 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.Quoted 2 lines
Of course, there is no need (perhaps counterproductive) to say "branch" if the context makes it clear it is referring to a branch.
Hello Ruben,
Quoted 9 lines · Rubén Justo
Quoted 5 lines · Dragan Simic
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.
Quoted 2 lines
I find it interesting to have common terms like "<commit>" "<path>", "<envvar>"...
... or "<branch>". :)
Quoted 4 lines
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.
Quoted 13 lines
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.
Quoted 2 lines
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.
Quoted 7 lines
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.
Quoted 15 lines
Quoted 4 lines
'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
Quoted 2 lines
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.
Quoted 14 lines
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>
Quoted 8 lines
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.
Quoted 4 lines
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.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
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.
Quoted 10 lines · Dragan Simic
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.
Awful. While I was skimming the messages without reading the Subject line (hence without realizing that this is about improving the existing documentation and not adding new features), I thought that these two are about moving branch to a remote repository that is named with <destination>.
My advice would be to stick to <old> vs <new> that contrasts well.
Thanks.
Hello Junio,
Quoted 13 lines · Junio C Hamano
Quoted 10 lines · Dragan Simic
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.
Quoted 7 lines
Awful. While I was skimming the messages without reading the Subject line (hence without realizing that this is about improving the existing documentation and not adding new features), I thought that these two are about moving branch to a remote repository that is named with <destination>.
My advice would be to stick to <old> vs <new> that contrasts well.
I appreciate the directness and honesty. How about using "<oldbranch>" and "<newbranch>" instead, which, although more wordy, would be more consistent with "<branch>" that's used in a number of other places? Such consistency should make the users recognize the arguments better at first glance.
Quoted 5 lines · Dragan Simic
Quoted 1 line
My advice would be to stick to <old> vs <new> that contrasts well.
I appreciate the directness and honesty. How about using "<oldbranch>" and "<newbranch>" instead, which, although more wordy, would be more consistent with "<branch>" that's used in a number of other places?
I have slight aversion to non-words like "oldbranch" (not "old-branch"), but not that much.
Quite honestly, in a document whose primary topic is "branch", I doubt that repeating "branch" all over the place would be the consistency we should be aiming for in the first place, when it is clear from the context that we are talking about branches.
The updates we are making to Documentation/git-branch.txt that (1) slims wordy description of different modes in the DESCRIPTION section, (2) make option description of "-m" mention what argument(s) the option takes, and (3) rmove standalone <newbranch> and <oldbranch> description are all about making the necessary piece of information easier to find in one place (namely, the option description where "-m [<one branch name>] [<the other branch name>]" is described) without having to jump around all over in the documentation, so in that sense, I would think the way to go is to aim for brevity that takes advantage of the local context.
Quoted 2 lines · Junio C Hamano
I have slight aversion to non-words like "oldbranch" (not "old-branch"), but not that much.
I also have problems with <old...>. What's the reference in "old"?
Prior to the restructuring of the whole file, we should probably do:
---- >8 --------- >8 --------- >8 --------- >8 ------
Subject: [PATCH] branch: adjust documentation
Adjust the terms we use in Documentation/git-branch.txt to what we say in CodingGuideLines:
If a placeholder has multiple words, they are separated by dashes:
<new-branch-name>
--template=<template-directory>
Best viewed with --word-diff.
--- Documentation/git-branch.txt | 57 +++++++++++++++++------------------- 1 file changed, 27 insertions(+), 30 deletions(-)
Documentation/git-branch.txt +27 -30
@@ -17,13 +17,13 @@ SYNOPSIS [(-r | --remotes) | (-a | --all)] [--list] [<pattern>...] 'git branch' [--track[=(direct|inherit)] | --no-track] [-f] - [--recurse-submodules] <branchname> [<start-point>] -'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>] -'git branch' --unset-upstream [<branchname>] -'git branch' (-m | -M) [<oldbranch>] <newbranch> -'git branch' (-c | -C) [<oldbranch>] <newbranch> -'git branch' (-d | -D) [-r] <branchname>... -'git branch' --edit-description [<branchname>] + [--recurse-submodules] <new-branch> [<start-point>] +'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branch>] +'git branch' --unset-upstream [<branch>] +'git branch' (-m | -M) [<branch>] <new-branch> +'git branch' (-c | -C) [<branch>] <new-branch> +'git branch' (-d | -D) [-r] <branch>... +'git branch' --edit-description [<branch>] DESCRIPTION -----------
@@ -53,7 +53,7 @@ branches not merged into the named commit will be listed. If the <commit> argument is missing it defaults to `HEAD` (i.e. the tip of the current branch). -The command's second form creates a new branch head named <branchname> +The command's second form creates a new branch head named <branch> which points to the current `HEAD`, or <start-point> if given. As a special case, for <start-point>, you may use `"A...B"` as a shortcut for the merge base of `A` and `B` if there is exactly one merge base. You
@@ -61,7 +61,7 @@ can leave out at most one of `A` and `B`, in which case it defaults to `HEAD`. Note that this will create the new branch, but it will not switch the -working tree to it; use "git switch <newbranch>" to switch to the +working tree to it; use "git switch" to switch to the new branch. When a local branch is started off a remote-tracking branch, Git sets up the
@@ -72,17 +72,17 @@ 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 +With a `-m` or `-M` option, <branch> will be renamed to <new-branch>. +If <branch> had a corresponding reflog, it is renamed to match +<new-branch>, and a reflog entry is created to remember the branch +renaming. If <new-branch> 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 +With a `-d` or `-D` option, `<branch>` 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.
@@ -107,7 +107,7 @@ OPTIONS --create-reflog:: Create the branch's reflog. This activates recording of all changes made to the branch ref, enabling use of date - based sha1 expressions such as "<branchname>@\{yesterday}". + based sha1 expressions such as "<branch>@\{yesterday}". Note that in non-bare repositories, reflogs are usually enabled by default by the `core.logAllRefUpdates` config option. The negated form `--no-create-reflog` only overrides an earlier
@@ -116,7 +116,7 @@ OPTIONS -f:: --force:: - Reset <branchname> to <start-point>, even if <branchname> exists + Reset <branch> to <start-point>, even if <branch> exists already. Without `-f`, 'git branch' refuses to change an existing branch. In combination with `-d` (or `--delete`), allow deleting the branch irrespective of its merged status, or whether it even
@@ -124,8 +124,8 @@ OPTIONS `-m` (or `--move`), allow renaming the branch even if the new branch name already exists, the same applies for `-c` (or `--copy`). + -Note that 'git branch -f <branchname> [<start-point>]', even with '-f', -refuses to change an existing branch `<branchname>` that is checked out +Note that 'git branch -f <branch> [<start-point>]', even with '-f', +refuses to change an existing branch `<branch>` that is checked out in another worktree linked to the same repository. -m::
@@ -255,7 +255,7 @@ how the `branch.<name>.remote` and `branch.<name>.merge` options are used. linkgit:git-config[1]. Currently, only branch creation is supported. + -When used in branch creation, a new branch <branchname> will be created +When used in branch creation, a new branch <branch> will be created in the superproject and all of the submodules in the superproject's <start-point>. In submodules, the branch will point to the submodule commit in the superproject's <start-point> but the branch's tracking
@@ -270,12 +270,12 @@ superproject's "origin/main", but tracks the submodule's "origin/main". -u <upstream>:: --set-upstream-to=<upstream>:: - Set up <branchname>'s tracking information so <upstream> is - considered <branchname>'s upstream branch. If no <branchname> + Set up <branch>'s tracking information so <upstream> is + considered <branch>'s upstream branch. If no <branch> is specified, then it defaults to the current branch. --unset-upstream:: - Remove the upstream information for <branchname>. If no branch + Remove the upstream information for <branch>. If no branch is specified it defaults to the current branch. --edit-description::
@@ -300,24 +300,21 @@ superproject's "origin/main", but tracks the submodule's "origin/main". Only list branches whose tips are not reachable from the specified commit (HEAD if not specified). Implies `--list`. -<branchname>:: +<branch>:: The name of the branch to create or delete. The new branch name must pass all checks defined by linkgit:git-check-ref-format[1]. Some of these checks may restrict the characters allowed in a branch name. + If ommited, the current branch will be used instead. <start-point>:: The new branch head will point to this commit. It may be 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. +<new-branch>:: + The name for new branch. The same restrictions as for + <branch> apply. --sort=<key>:: Sort based on the key given. Prefix `-` to sort in descending
Signature · 1 line
2.44.0.rc2
Quoted 8 lines · Rubén Justo
Quoted 2 lines · Junio C Hamano
I have slight aversion to non-words like "oldbranch" (not "old-branch"), but not that much.
I also have problems with <old...>. What's the reference in "old"?
Prior to the restructuring of the whole file, we should probably do:
FWIW, I'm perfectly fine with having your patch, available below, applied right now. To me, it would provide a true improvement.
Quoted 182 lines
---- >8 --------- >8 --------- >8 --------- >8 ------
Subject: [PATCH] branch: adjust documentationAdjust the terms we use in
Documentation/git-branch.txtto what we say in CodingGuideLines:If a placeholder has multiple words, they are separated by dashes:
<new-branch-name>
--template=<template-directory>Best viewed with --word-diff.
Signed-off-by Rubén Justo <[email protected]>--- Documentation/git-branch.txt | 57 +++++++++++++++++------------------- 1 file changed, 27 insertions(+), 30 deletions(-)Documentation/git-branch.txt +0
-2@@ -17,13 +17,13 @@ SYNOPSIS [(-r | --remotes) | (-a | --all)] [--list] [<pattern>...] 'git branch' [--track[=(direct|inherit)] | --no-track] [-f] - [--recurse-submodules] <branchname> [<start-point>] -'git branch' (--set-upstream-to=<upstream> | -u <upstream>)[<branchname>]
-'git branch' --unset-upstream [<branchname>]-'git branch' (-m | -M) [<oldbranch>] <newbranch> -'git branch' (-c | -C) [<oldbranch>] <newbranch> -'git branch' (-d | -D) [-r] <branchname>...-'git branch' --edit-description [<branchname>]
Documentation/git-branch.txt +7
-0+ [--recurse-submodules] <new-branch> [<start-point>] +'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branch>] +'git branch' --unset-upstream [<branch>] +'git branch' (-m | -M) [<branch>] <new-branch> +'git branch' (-c | -C) [<branch>] <new-branch> +'git branch' (-d | -D) [-r] <branch>... +'git branch' --edit-description [<branch>] DESCRIPTION -----------@@ -53,7 +53,7 @@ branches not merged into the named commit will belisted. If the <commit>
argument is missing it defaults toHEAD(i.e. the tip of the current branch).Documentation/git-branch.txt +1
-1-The command's second form creates a new branch head named <branchname> +The command's second form creates a new branch head named <branch> which points to the current `HEAD`, or <start-point> if given. As a special case, for <start-point>, you may use `"A...B"` as a shortcutfor
the merge base ofAandBif there is exactly one merge base. YouDocumentation/git-branch.txt +0
-0@@ -61,7 +61,7 @@ can leave out at most one of `A` and `B`, in whichcase it defaults to
HEAD.Note that this will create the new branch, but it will not switch the
Documentation/git-branch.txt +1
-1-working tree to it; use "git switch <newbranch>" to switch to the +working tree to it; use "git switch" to switch to the new branch. When a local branch is started off a remote-tracking branch, Git setsup the
Documentation/git-branch.txt +0
-0@@ -72,17 +72,17 @@ the remote-tracking branch. This behavior may bechanged via the global
overridden by using the--trackand--no-trackoptions, and changed later usinggit branch --set-upstream-to.-With a
-mor-Moption, <oldbranch> will be renamed to <newbranch>.Documentation/git-branch.txt +4
-3-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 +With a `-m` or `-M` option, <branch> will be renamed to <new-branch>. +If <branch> had a corresponding reflog, it is renamed to match +<new-branch>, and a reflog entry is created to remember the branch +renaming. If <new-branch> 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 toa
new name, along with its config and reflog.Documentation/git-branch.txt +3
-3-With a `-d` or `-D` option, `<branchname>` will be deleted. You may +With a `-d` or `-D` option, `<branch>` 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.@@ -107,7 +107,7 @@ OPTIONS --create-reflog:: Create the branch's reflog. This activates recording of all changes made to the branch ref, enabling use of date - based sha1 expressions such as "<branchname>@\{yesterday}". + based sha1 expressions such as "<branch>@\{yesterday}". Note that in non-bare repositories, reflogs are usually enabled by default by the `core.logAllRefUpdates` config option. The negated form `--no-create-reflog` only overrides an earlier@@ -116,7 +116,7 @@ OPTIONS -f:: --force:: - Reset <branchname> to <start-point>, even if <branchname> exists + Reset <branch> to <start-point>, even if <branch> exists already. Without `-f`, 'git branch' refuses to change an existingbranch.
Documentation/git-branch.txt +0
-2In combination with `-d` (or `--delete`), allow deleting the branch irrespective of its merged status, or whether it even@@ -124,8 +124,8 @@ OPTIONS `-m` (or `--move`), allow renaming the branch even if the new branch name already exists, the same applies for `-c` (or `--copy`). + -Note that 'git branch -f <branchname> [<start-point>]', even with '-f', -refuses to change an existing branch `<branchname>` that is checkedout
Documentation/git-branch.txt +2
-0+Note that 'git branch -f <branch> [<start-point>]', even with '-f', +refuses to change an existing branch `<branch>` that is checked out in another worktree linked to the same repository. -m::@@ -255,7 +255,7 @@ how the `branch.<name>.remote` and
branch.<name>.mergeoptions are used.Documentation/git-branch.txt +0
-1linkgit:git-config[1]. Currently, only branch creation is supported. + -When used in branch creation, a new branch <branchname> will becreated
Documentation/git-branch.txt +1
-0+When used in branch creation, a new branch <branch> will be created in the superproject and all of the submodules in the superproject's <start-point>. In submodules, the branch will point to the submodule commit in the superproject's <start-point> but the branch's tracking@@ -270,12 +270,12 @@ superproject's "origin/main", but tracks thesubmodule's "origin/main".
-u <upstream>::
--set-upstream-to=<upstream>::Documentation/git-branch.txt +3
-3- Set up <branchname>'s tracking information so <upstream> is - considered <branchname>'s upstream branch. If no <branchname> + Set up <branch>'s tracking information so <upstream> is + considered <branch>'s upstream branch. If no <branch> is specified, then it defaults to the current branch. --unset-upstream:: - Remove the upstream information for <branchname>. If no branch + Remove the upstream information for <branch>. If no branch is specified it defaults to the current branch. --edit-description::@@ -300,24 +300,21 @@ superproject's "origin/main", but tracks thesubmodule's "origin/main".
Documentation/git-branch.txt +5
-8Only list branches whose tips are not reachable from the specified commit (HEAD if not specified). Implies `--list`. -<branchname>:: +<branch>:: The name of the branch to create or delete. The new branch name must pass all checks defined by linkgit:git-check-ref-format[1]. Some of these checks may restrict the characters allowed in a branch name. + If ommited, the current branch will be used instead. <start-point>:: The new branch head will point to this commit. It may be 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. +<new-branch>:: + The name for new branch. The same restrictions as for + <branch> apply. --sort=<key>:: Sort based on the key given. Prefix `-` to sort in descending
PATCH 1/1 branch: adjust documentation
In reply to Rubén JustoAdjust the placeholders we use in Documentation/git-branch.txt to what we say in CodingGuideLines:
If a placeholder has multiple words, they are separated by dashes:
<new-branch-name>
--template=<template-directory>
Best viewed with --word-diff.
---
Documentation/git-branch.txt | 54 +++++++++++++++++------------------- 1 file changed, 25 insertions(+), 29 deletions(-)
Documentation/git-branch.txt +25 -29
@@ -17,13 +17,13 @@ SYNOPSIS [(-r | --remotes) | (-a | --all)] [--list] [<pattern>...] 'git branch' [--track[=(direct|inherit)] | --no-track] [-f] - [--recurse-submodules] <branchname> [<start-point>] -'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>] -'git branch' --unset-upstream [<branchname>] -'git branch' (-m | -M) [<oldbranch>] <newbranch> -'git branch' (-c | -C) [<oldbranch>] <newbranch> -'git branch' (-d | -D) [-r] <branchname>... -'git branch' --edit-description [<branchname>] + [--recurse-submodules] <new-branch> [<start-point>] +'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branch>] +'git branch' --unset-upstream [<branch>] +'git branch' (-m | -M) [<branch>] <new-branch> +'git branch' (-c | -C) [<branch>] <new-branch> +'git branch' (-d | -D) [-r] <branch>... +'git branch' --edit-description [<branch>] DESCRIPTION -----------
@@ -53,7 +53,7 @@ branches not merged into the named commit will be listed. If the <commit> argument is missing it defaults to `HEAD` (i.e. the tip of the current branch). -The command's second form creates a new branch head named <branchname> +The command's second form creates a new branch head named <new-branch> which points to the current `HEAD`, or <start-point> if given. As a special case, for <start-point>, you may use `"A...B"` as a shortcut for the merge base of `A` and `B` if there is exactly one merge base. You
@@ -61,7 +61,7 @@ can leave out at most one of `A` and `B`, in which case it defaults to `HEAD`. Note that this will create the new branch, but it will not switch the -working tree to it; use "git switch <newbranch>" to switch to the +working tree to it; use "git switch <new-branch>" to switch to the new branch. When a local branch is started off a remote-tracking branch, Git sets up the
@@ -72,17 +72,17 @@ 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 +With a `-m` or `-M` option, <branch> will be renamed to <new-branch>. +If <branch> had a corresponding reflog, it is renamed to match +<new-branch>, and a reflog entry is created to remember the branch +renaming. If <new-branch> 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 +With a `-d` or `-D` option, `<branch>` 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.
@@ -107,7 +107,7 @@ OPTIONS --create-reflog:: Create the branch's reflog. This activates recording of all changes made to the branch ref, enabling use of date - based sha1 expressions such as "<branchname>@\{yesterday}". + based sha1 expressions such as "<branch>@\{yesterday}". Note that in non-bare repositories, reflogs are usually enabled by default by the `core.logAllRefUpdates` config option. The negated form `--no-create-reflog` only overrides an earlier
@@ -116,7 +116,7 @@ OPTIONS -f:: --force:: - Reset <branchname> to <start-point>, even if <branchname> exists + Reset <new-branch> to <start-point>, even if <new-branch> exists already. Without `-f`, 'git branch' refuses to change an existing branch. In combination with `-d` (or `--delete`), allow deleting the branch irrespective of its merged status, or whether it even
@@ -124,8 +124,8 @@ OPTIONS `-m` (or `--move`), allow renaming the branch even if the new branch name already exists, the same applies for `-c` (or `--copy`). + -Note that 'git branch -f <branchname> [<start-point>]', even with '-f', -refuses to change an existing branch `<branchname>` that is checked out +Note that 'git branch -f <new-branch> [<start-point>]', even with '-f', +refuses to change an existing branch `<new-branch>` that is checked out in another worktree linked to the same repository. -m::
@@ -255,7 +255,7 @@ how the `branch.<name>.remote` and `branch.<name>.merge` options are used. linkgit:git-config[1]. Currently, only branch creation is supported. + -When used in branch creation, a new branch <branchname> will be created +When used in branch creation, a new branch <new-branch> will be created in the superproject and all of the submodules in the superproject's <start-point>. In submodules, the branch will point to the submodule commit in the superproject's <start-point> but the branch's tracking
@@ -270,12 +270,12 @@ superproject's "origin/main", but tracks the submodule's "origin/main". -u <upstream>:: --set-upstream-to=<upstream>:: - Set up <branchname>'s tracking information so <upstream> is - considered <branchname>'s upstream branch. If no <branchname> + Set up <branch>'s tracking information so <upstream> is + considered <branch>'s upstream branch. If no <branch> is specified, then it defaults to the current branch. --unset-upstream:: - Remove the upstream information for <branchname>. If no branch + Remove the upstream information for <branch>. If no branch is specified it defaults to the current branch. --edit-description::
@@ -300,8 +300,8 @@ superproject's "origin/main", but tracks the submodule's "origin/main". Only list branches whose tips are not reachable from the specified commit (HEAD if not specified). Implies `--list`. -<branchname>:: - The name of the branch to create or delete. +<new-branch>:: + The name of the branch to create. The new branch name must pass all checks defined by linkgit:git-check-ref-format[1]. Some of these checks may restrict the characters allowed in a branch name.
@@ -311,14 +311,10 @@ 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>:: +<branch>:: 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
Signature · 1 line
2.44.0.rc2
Re: [PATCH] branch: adjust documentation
Quoted 10 lines · Rubén Justo
Adjust the placeholders we use in
Documentation/git-branch.txtto what we say in CodingGuideLines:If a placeholder has multiple words, they are separated by dashes:
<new-branch-name>
--template=<template-directory>Best viewed with --word-diff.
Signed-off-by Rubén Justo <[email protected]>
Looking good to me!
Quoted 171 lines
---
Documentation/git-branch.txt | 54 +++++++++++++++++------------------- 1 file changed, 25 insertions(+), 29 deletions(-)Documentation/git-branch.txt +0
-2@@ -17,13 +17,13 @@ SYNOPSIS [(-r | --remotes) | (-a | --all)] [--list] [<pattern>...] 'git branch' [--track[=(direct|inherit)] | --no-track] [-f] - [--recurse-submodules] <branchname> [<start-point>] -'git branch' (--set-upstream-to=<upstream> | -u <upstream>)[<branchname>]
-'git branch' --unset-upstream [<branchname>]-'git branch' (-m | -M) [<oldbranch>] <newbranch> -'git branch' (-c | -C) [<oldbranch>] <newbranch> -'git branch' (-d | -D) [-r] <branchname>...-'git branch' --edit-description [<branchname>]
Documentation/git-branch.txt +7
-0+ [--recurse-submodules] <new-branch> [<start-point>] +'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branch>] +'git branch' --unset-upstream [<branch>] +'git branch' (-m | -M) [<branch>] <new-branch> +'git branch' (-c | -C) [<branch>] <new-branch> +'git branch' (-d | -D) [-r] <branch>... +'git branch' --edit-description [<branch>] DESCRIPTION -----------@@ -53,7 +53,7 @@ branches not merged into the named commit will belisted. If the <commit>
argument is missing it defaults toHEAD(i.e. the tip of the current branch).Documentation/git-branch.txt +1
-1-The command's second form creates a new branch head named <branchname> +The command's second form creates a new branch head named <new-branch> which points to the current `HEAD`, or <start-point> if given. As a special case, for <start-point>, you may use `"A...B"` as a shortcutfor
the merge base ofAandBif there is exactly one merge base. YouDocumentation/git-branch.txt +0
-0@@ -61,7 +61,7 @@ can leave out at most one of `A` and `B`, in whichcase it defaults to
HEAD.Note that this will create the new branch, but it will not switch the
Documentation/git-branch.txt +1
-1-working tree to it; use "git switch <newbranch>" to switch to the +working tree to it; use "git switch <new-branch>" to switch to the new branch. When a local branch is started off a remote-tracking branch, Git setsup the
Documentation/git-branch.txt +0
-0@@ -72,17 +72,17 @@ the remote-tracking branch. This behavior may bechanged via the global
overridden by using the--trackand--no-trackoptions, and changed later usinggit branch --set-upstream-to.-With a
-mor-Moption, <oldbranch> will be renamed to <newbranch>.Documentation/git-branch.txt +4
-3-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 +With a `-m` or `-M` option, <branch> will be renamed to <new-branch>. +If <branch> had a corresponding reflog, it is renamed to match +<new-branch>, and a reflog entry is created to remember the branch +renaming. If <new-branch> 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 toa
new name, along with its config and reflog.Documentation/git-branch.txt +3
-3-With a `-d` or `-D` option, `<branchname>` will be deleted. You may +With a `-d` or `-D` option, `<branch>` 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.@@ -107,7 +107,7 @@ OPTIONS --create-reflog:: Create the branch's reflog. This activates recording of all changes made to the branch ref, enabling use of date - based sha1 expressions such as "<branchname>@\{yesterday}". + based sha1 expressions such as "<branch>@\{yesterday}". Note that in non-bare repositories, reflogs are usually enabled by default by the `core.logAllRefUpdates` config option. The negated form `--no-create-reflog` only overrides an earlier@@ -116,7 +116,7 @@ OPTIONS -f:: --force:: - Reset <branchname> to <start-point>, even if <branchname> exists + Reset <new-branch> to <start-point>, even if <new-branch> exists already. Without `-f`, 'git branch' refuses to change an existingbranch.
Documentation/git-branch.txt +0
-2In combination with `-d` (or `--delete`), allow deleting the branch irrespective of its merged status, or whether it even@@ -124,8 +124,8 @@ OPTIONS `-m` (or `--move`), allow renaming the branch even if the new branch name already exists, the same applies for `-c` (or `--copy`). + -Note that 'git branch -f <branchname> [<start-point>]', even with '-f', -refuses to change an existing branch `<branchname>` that is checkedout
+Note that 'git branch -f <new-branch> [<start-point>]', even with '-f',
+refuses to change an existing branch<new-branch>that is checked out
in another worktree linked to the same repository.-m::
Documentation/git-branch.txt +0
-0@@ -255,7 +255,7 @@ how the `branch.<name>.remote` and
branch.<name>.mergeoptions are used.Documentation/git-branch.txt +0
-1linkgit:git-config[1]. Currently, only branch creation is supported. + -When used in branch creation, a new branch <branchname> will becreated
+When used in branch creation, a new branch <new-branch> will be created
in the superproject and all of the submodules in the superproject's <start-point>. In submodules, the branch will point to the submodule commit in the superproject's <start-point> but the branch's trackingDocumentation/git-branch.txt +0
-0@@ -270,12 +270,12 @@ superproject's "origin/main", but tracks thesubmodule's "origin/main".
-u <upstream>::
--set-upstream-to=<upstream>::Documentation/git-branch.txt +3
-3- Set up <branchname>'s tracking information so <upstream> is - considered <branchname>'s upstream branch. If no <branchname> + Set up <branch>'s tracking information so <upstream> is + considered <branch>'s upstream branch. If no <branch> is specified, then it defaults to the current branch. --unset-upstream:: - Remove the upstream information for <branchname>. If no branch + Remove the upstream information for <branch>. If no branch is specified it defaults to the current branch. --edit-description::@@ -300,8 +300,8 @@ superproject's "origin/main", but tracks thesubmodule's "origin/main".
Documentation/git-branch.txt +2
-2Only list branches whose tips are not reachable from the specified commit (HEAD if not specified). Implies `--list`. -<branchname>:: - The name of the branch to create or delete. +<new-branch>:: + The name of the branch to create. The new branch name must pass all checks defined by linkgit:git-check-ref-format[1]. Some of these checks may restrict the characters allowed in a branch name.@@ -311,14 +311,10 @@ superproject's "origin/main", but tracks thesubmodule's "origin/main".
Documentation/git-branch.txt +1
-5given as a branch name, a commit-id, or a tag. If this option is omitted, the current HEAD will be used instead. -<oldbranch>:: +<branch>:: 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
Re: [PATCH] branch: adjust documentation
Hello Junio,
Quoted 8 lines · Dragan Simic
Quoted 7 lines · Rubén Justo
Adjust the placeholders we use in
Documentation/git-branch.txtto what we say in CodingGuideLines:If a placeholder has multiple words, they are separated by dashes:
<new-branch-name>
--template=<template-directory>
Quoted 5 lines
Quoted 3 lines
Best viewed with --word-diff.
Signed-off-by Rubén Justo <[email protected]>Looking good to me!
Just checking, do you see the changes that Ruben proposed in this patch fit for our starting point in the git-branch documentation rewrite?
Quoted 178 lines
Reviewed-by Dragan Simic <[email protected]>Quoted 176 lines
---
Documentation/git-branch.txt | 54 +++++++++++++++++------------------- 1 file changed, 25 insertions(+), 29 deletions(-)Documentation/git-branch.txt +0
-2@@ -17,13 +17,13 @@ SYNOPSIS [(-r | --remotes) | (-a | --all)] [--list] [<pattern>...] 'git branch' [--track[=(direct|inherit)] | --no-track] [-f] - [--recurse-submodules] <branchname> [<start-point>] -'git branch' (--set-upstream-to=<upstream> | -u <upstream>)[<branchname>]
-'git branch' --unset-upstream [<branchname>]-'git branch' (-m | -M) [<oldbranch>] <newbranch> -'git branch' (-c | -C) [<oldbranch>] <newbranch> -'git branch' (-d | -D) [-r] <branchname>...-'git branch' --edit-description [<branchname>]
Documentation/git-branch.txt +2
-0+ [--recurse-submodules] <new-branch> [<start-point>] +'git branch' (--set-upstream-to=<upstream> | -u <upstream>)[<branch>]
+'git branch' --unset-upstream [<branch>]+'git branch' (-m | -M) [<branch>] <new-branch> +'git branch' (-c | -C) [<branch>] <new-branch> +'git branch' (-d | -D) [-r] <branch>...+'git branch' --edit-description [<branch>]
DESCRIPTION
-----------Documentation/git-branch.txt +0
-0@@ -53,7 +53,7 @@ branches not merged into the named commit will belisted. If the <commit>
argument is missing it defaults toHEAD(i.e. the tip of the
current
branch).-The command's second form creates a new branch head named <branchname>
+The command's second form creates a new branch head named <new-branch>
which points to the currentHEAD, or <start-point> if given. As a special case, for <start-point>, you may use"A...B"as a shortcut
for
the merge base ofAandBif there is exactly one merge base. YouDocumentation/git-branch.txt +0
-0@@ -61,7 +61,7 @@ can leave out at most one of `A` and `B`, in whichcase it defaults to
HEAD.Note that this will create the new branch, but it will not switch the
Documentation/git-branch.txt +1
-1-working tree to it; use "git switch <newbranch>" to switch to the +working tree to it; use "git switch <new-branch>" to switch to the new branch. When a local branch is started off a remote-tracking branch, Git setsup the
Documentation/git-branch.txt +0
-0@@ -72,17 +72,17 @@ the remote-tracking branch. This behavior may bechanged via the global
overridden by using the--trackand--no-trackoptions, and changed later usinggit branch --set-upstream-to.-With a
-mor-Moption, <oldbranch> will be renamed to <newbranch>.Documentation/git-branch.txt +4
-3-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 +With a `-m` or `-M` option, <branch> will be renamed to <new-branch>. +If <branch> had a corresponding reflog, it is renamed to match +<new-branch>, and a reflog entry is created to remember the branch +renaming. If <new-branch> 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 copiedto a
new name, along with its config and reflog.Documentation/git-branch.txt +3
-3-With a `-d` or `-D` option, `<branchname>` will be deleted. You may +With a `-d` or `-D` option, `<branch>` 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.@@ -107,7 +107,7 @@ OPTIONS --create-reflog:: Create the branch's reflog. This activates recording of all changes made to the branch ref, enabling use of date - based sha1 expressions such as "<branchname>@\{yesterday}". + based sha1 expressions such as "<branch>@\{yesterday}". Note that in non-bare repositories, reflogs are usually enabled by default by the `core.logAllRefUpdates` config option. The negated form `--no-create-reflog` only overrides an earlier@@ -116,7 +116,7 @@ OPTIONS -f:: --force:: - Reset <branchname> to <start-point>, even if <branchname> exists + Reset <new-branch> to <start-point>, even if <new-branch> exists already. Without `-f`, 'git branch' refuses to change an existingbranch.
Documentation/git-branch.txt +0
-2In combination with `-d` (or `--delete`), allow deleting the branch irrespective of its merged status, or whether it even@@ -124,8 +124,8 @@ OPTIONS `-m` (or `--move`), allow renaming the branch even if the new branch name already exists, the same applies for `-c` (or `--copy`). + -Note that 'git branch -f <branchname> [<start-point>]', even with '-f', -refuses to change an existing branch `<branchname>` that is checkedout
+Note that 'git branch -f <new-branch> [<start-point>]', even with '-f',
+refuses to change an existing branch<new-branch>that is checked out
in another worktree linked to the same repository.-m::
Documentation/git-branch.txt +0
-0@@ -255,7 +255,7 @@ how the `branch.<name>.remote` and
branch.<name>.mergeoptions are used.Documentation/git-branch.txt +0
-1linkgit:git-config[1]. Currently, only branch creation is supported. + -When used in branch creation, a new branch <branchname> will becreated
+When used in branch creation, a new branch <new-branch> will be created
in the superproject and all of the submodules in the superproject's <start-point>. In submodules, the branch will point to the submodule commit in the superproject's <start-point> but the branch's trackingDocumentation/git-branch.txt +0
-0@@ -270,12 +270,12 @@ superproject's "origin/main", but tracks thesubmodule's "origin/main".
-u <upstream>::
--set-upstream-to=<upstream>::Documentation/git-branch.txt +3
-3- Set up <branchname>'s tracking information so <upstream> is - considered <branchname>'s upstream branch. If no <branchname> + Set up <branch>'s tracking information so <upstream> is + considered <branch>'s upstream branch. If no <branch> is specified, then it defaults to the current branch. --unset-upstream:: - Remove the upstream information for <branchname>. If no branch + Remove the upstream information for <branch>. If no branch is specified it defaults to the current branch. --edit-description::@@ -300,8 +300,8 @@ superproject's "origin/main", but tracks thesubmodule's "origin/main".
Documentation/git-branch.txt +2
-2Only list branches whose tips are not reachable from the specified commit (HEAD if not specified). Implies `--list`. -<branchname>:: - The name of the branch to create or delete. +<new-branch>:: + The name of the branch to create. The new branch name must pass all checks defined by linkgit:git-check-ref-format[1]. Some of these checks may restrict the characters allowed in a branch name.@@ -311,14 +311,10 @@ superproject's "origin/main", but tracks thesubmodule's "origin/main".
Documentation/git-branch.txt +1
-5given as a branch name, a commit-id, or a tag. If this option is omitted, the current HEAD will be used instead. -<oldbranch>:: +<branch>:: 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
Re: [PATCH] branch: adjust documentation
Quoted 4 lines · Dragan Simic
Hello Junio,
Just checking, do you see the changes that Ruben proposed in this patch fit for our starting point in the git-branch documentation rewrite?
The synopsis part may, but with reservations. I know you two are aiming to make this in many small incremental steps, but even then I'd have to say the way these placeholder words will be used in the text part (both DESCRIPTION and OPTIONS) will be so different from the final shape envisioned [*1*], the wording that may fit well within the current text might not be the best fit in the final text.
The current description section talks about option and its arguments without showing the syntax, making it unnecessary to be extra verbose. For example, we see something like this:
With a -m or -M option, <oldbranch> will be renamed to <newbranch>. If <oldbranch> had a corresponding reflog, it is renamed to match ...
But in the final shape of the documentation, I would like to see the description section not talk about these arguments, and would read more like
When given -m or -M options, the command renames an existing branch to a different name.
among short descriptions made at the conceptual level on other modes like "listing" mode, "delete" mode, etc. [*3*]
And the option description would become something like [*]:
-m [<one>] <two>::
Renames the branch <one> (the current branch is used when not given) to a new name <two>, together with its reflog and configuration settings for the branch. ...
Side note: <one> and <two> are meta-placeholders for the purpose of this document; Ruben's patch proposes to call them <branch> and <new-branch>.
Now in such a context, <one> and <two> placeholders having actually the word "branch" in it would sound redundant and awkward to read, Even though the choice of words Ruben made in the patch under discussion may work well in the current document structure. I suspect these words will have to be chosen again when we start making the real organizational changes to the description and options sections.
In other words, I do not think that the patch makes an effective "one good step in the right direction". At least, I couldn't see how the wording for placeholders the patch proposes to use would be helpful in deciding the placeholders used in the final version.
Thanks for pinging.
[Footnotes]
*1* Do we share the vision on how the final version should look
like? Here I am assuming "the final shape envisioned" is along the lines of [*2*], i.e.
(1) trim descriptions to just enumerate different modes of operations with explanation on what they do at the conceptual level;
(2) make each entry in the options section self contained, by showing the option with their <argument>s, referring to them in the explanation text;
(3) remove non-option <argument> from the options list.
*2* https://lore.kernel.org/git/[email protected]/
*3* Because "git branch" does so many things, the DESCRIPTION
section should first say the purpose of the section is to serve as brief catalog of features to help readers to find the entry in the option section to jump to quickly. Something like:
The "git branch" command works in many modes (see SYNOPSIS above). By default the command works in the "list" option (the --list option explicitly asks for this mode).
will be at the beginning of the section. The first four paragraphs in the current DESCRIPTION section is about this list mode. The first three of them should probably be moved to the OPTIONS section under --list. The fourth paragraph should be split and described in the entries of individual options it talks about in the OPTIONS section.
.
Re: [PATCH] branch: adjust documentation
Quoted 3 lines · Junio C Hamano
The current description section talks about option and its arguments without showing the syntax, making it unnecessary to be extra verbose. For example, we see something like this:
"unnecessarily extra verbose" is what I meant to say.
Re: [PATCH] branch: adjust documentation
In reply to Junio C HamanoQuoted 3 lines · Junio C Hamano
Quoted 2 lines · Dragan Simic
Just checking, do you see the changes that Ruben proposed in this patch fit for our starting point in the git-branch documentation rewrite?
First of all, I _really_ appreciate your highly detailed feedback. Thank you very much for taking the time to write it all down!
Quoted 6 lines
The synopsis part may, but with reservations. I know you two are aiming to make this in many small incremental steps, but even then I'd have to say the way these placeholder words will be used in the text part (both DESCRIPTION and OPTIONS) will be so different from the final shape envisioned [*1*], the wording that may fit well within the current text might not be the best fit in the final text.
Please, let me remind you that I've already agreed upon doing it all in one fell swoop, which may consist of multiple patches in a series, but applied as a whole.
Quoted 12 lines
The current description section talks about option and its arguments without showing the syntax, making it unnecessary to be extra verbose. For example, we see something like this:
With a
-mor-Moption, <oldbranch> will be renamed to <newbranch>. If <oldbranch> had a corresponding reflog, it is renamed to match ...But in the final shape of the documentation, I would like to see the description section not talk about these arguments, and would read more like
Quoted 5 lines
When given
-mor-Moptions, the command renames an existing branch to a different name.among short descriptions made at the conceptual level on other modes like "listing" mode, "delete" mode, etc. [*3*]
I agree on that being the final outcome, because the descriptions of arguments actually belong to the envisioned "OPTIONS" section, as part of the command descriptions.
Quoted 11 lines
And the option description would become something like [*]:
-m [<one>] <two>::
Renames the branch <one> (the current branch is used when not given) to a new name <two>, together with its reflog and configuration settings for the branch. ...Side note: <one> and <two> are meta-placeholders for the purpose of this document; Ruben's patch proposes to call them <branch> and <new-branch>.
Quoted 7 lines
Now in such a context, <one> and <two> placeholders having actually the word "branch" in it would sound redundant and awkward to read, Even though the choice of words Ruben made in the patch under discussion may work well in the current document structure. I suspect these words will have to be chosen again when we start making the real organizational changes to the description and options sections.
Well, perhaps it's the best to revisit the argument naming later.
Quoted 4 lines
In other words, I do not think that the patch makes an effective "one good step in the right direction". At least, I couldn't see how the wording for placeholders the patch proposes to use would be helpful in deciding the placeholders used in the final version.
I see, thanks for the clarification.
Quoted 9 lines
[Footnotes]
*1* Do we share the vision on how the final version should look
like? Here I am assuming "the final shape envisioned" is along the lines of [*2*], i.e.(1) trim descriptions to just enumerate different modes of operations with explanation on what they do at the conceptual level;
Yes, that's also how I see it. The "DESCRIPTION" sections should end up describing only the available different modes.
Quoted 3 lines
(2) make each entry in the options section self contained, by showing the option with their <argument>s, referring to them in the explanation text;
Agreed once again. The "OPTIONS" section should end up describing the available options, together with their respective arguments, in a way that doesn't require the reader to jump to other places in the document to fully understand each of the options.
Quoted 1 line
(3) remove non-option <argument> from the options list.
Yes, that goes along with the descriptions being self-contained.
Quoted 1 line
Sure, I already went through your message linked above, which already described it quite well.
Quoted 4 lines
*3* Because "git branch" does so many things, the DESCRIPTION
section should first say the purpose of the section is to serve as brief catalog of features to help readers to find the entry in the option section to jump to quickly. Something like:
Yup, as I already explained it above. To reiterate, the purpose of the "DESCRIPTION" section is to let the reader know what git-branch can do, in form of easily readable prose.
Quoted 10 lines
The "git branch" command works in many modes (see SYNOPSIS above). By default the command works in the "list" option (the
--listoption explicitly asks for this mode).will be at the beginning of the section. The first four paragraphs in the current DESCRIPTION section is about this list mode. The first three of them should probably be moved to the OPTIONS section under
--list. The fourth paragraph should be split and described in the entries of individual options it talks about in the OPTIONS section.
Agreed, once again. :) Most of the prose currently found in the "DESCRIPTION" section should actually be moved to the various command descriptions in the envisioned future "OPTIONS" section.
Re: [PATCH] branch: adjust documentation
In reply to Junio C HamanoQuoted 8 lines · Junio C Hamano
The current description section talks about option and its arguments without showing the syntax, making it unnecessarily extra verbose. For example, we see something like this:
With a
-mor-Moption, <oldbranch> will be renamed to <newbranch>. If <oldbranch> had a corresponding reflog, it is renamed to match ...
Quoted 7 lines
But in the final shape of the documentation, I would like to see the description section not talk about these arguments, and would read more like
When given
-mor-Moptions, the command renames an existing branch to a different name.
Good.
Quoted 5 lines
among short descriptions made at the conceptual level on other modes like "listing" mode, "delete" mode, etc. [*3*]
And the option description would become something like [*]:
Quoted 7 lines
-m [<one>] <two>::
Renames the branch <one> (the current branch is used when not given) to a new name <two>, together with its reflog and configuration settings for the branch. ...Now in such a context, <one> and <two> placeholders having actually the word "branch" in it would sound redundant and awkward to read,
Indeed.
But I'm on the fence. Do we have to use "Renames the branch <one>"?
If we wisely choose the placeholder, perhaps we can write:
-m [<one>] <two>::
Renames <one> (the current branch is used when not given) to a new name <two>, together with its reflog and configuration settings ...
And if <one> is _good enough_ then "current branch is used when ..." should seem somewhat redundant. So it could be possible to end up having something like:
-m [<one>] <two>::
Renames <one> to a new name <two>, together with its reflog and configuration settings ...
Are we going to say "the current branch is used when ..." in the description for the other options too? The description for "-c|-C", "--edit-description", "--unset-upstream", ... Perhaps we are, and it will sound repetitive. However, even if we do, with the _good enough_ placeholder the user will be able to fill the gaps we might leave in the documentation, like the one that presumably has bring us here:
[email protected].
And finally; Can't <one> and <two> be consistent with other bits we have in the documentation like the descriptions of "git switch <one>", "git checkout -b <two>" or "git init -b <three>"?
After the revamp, I'll be less happy (but happy :-) nonetheless) if we end up having a SYNOPSIS similar to the one we have today:
- Documentation/git-branch.txt:
'git branch' (-c | -C) [<one>] <two>
'git branch' (-d | -D) [-r] <three>...
'git branch' --edit-description [<three>]It seems to me to be made up of disconnected pieces.
And for reference:
- Documentation/git-switch.txt:
'git switch' [<options>] [--no-guess] <four>
'git switch' [<options>] --orphan <five> - Documentation/git-init.txt:
'git init' [--initial-branch=<six>]
My apologies if I'm pushing too hard on this and being reiterative in my messages in this series. My intention has been to explore the use we want of the placeholders. Of course, this is not at odds with my sympathy for the vision proposed. I agree on the direction.
Quoted 2 lines
Even though the choice of words Rubén made in the patch under discussion may work well in the current document structure.
My patch is mainly about CodingGuideLines:
If a placeholder has multiple words, they are separated by dashes:
<new-branch-name>
--template=<template-directory>
Re: [PATCH] branch: adjust documentation
Quoted 7 lines · Rubén Justo
If we wisely choose the placeholder, perhaps we can write:
-m [<one>] <two>::
Renames <one> (the current branch is used when not given) to a new name <two>, together with its reflog and configuration settings ...
Quoted 7 lines
And if <one> is
_goodenough_then "current branch is used when ..." should seem somewhat redundant. So it could be possible to end up having something like:-m [<one>] <two>::
Renames <one> to a new name <two>, together with its reflog and configuration settings ...
If you use <the-current-branch-or-a-named-branch> or something awkward like that as <one>, surely you can. But I do not think we want to go there. And neither <branch-name> or <old-branch> would remove the need for "if omitted then the current branch is used", I am afraid, even though there may be a way to rephrase it more concisely, e.g. "Rename the current branch (or <one> when given)..."
Quoted 4 lines
Are we going to say "the current branch is used when ..." in the description for the other options too? The description for "-c|-C", "--edit-description", "--unset-upstream", ... Perhaps we are, and it will sound repetitive.
Do not forget that the objective of the larger-picture-revamping of this page is to make the description of each option self-contained. Similarity between -m's description and -c's description does not count as being uselessly repetitive.
Quoted 8 lines
Quoted 2 lines
Even though the choice of words Rubén made in the patch under discussion may work well in the current document structure.
My patch is mainly about CodingGuideLines:
If a placeholder has multiple words, they are separated by dashes:
<new-branch-name>
--template=<template-directory>
Yes, and that will be something we want to address _after_ we pick what word or phrase would replace <one> or <two> in the above at the conceptual level. If we picked a single word, say "branch", we do not even need to worry about dashes, and spell it just <branch>. If we did not pick "old branch", then we'd use "<old-branch>", but doing such a conversion based on the current text is a wasted work, if we end up using say "original branch" as the phrase, for example.
So if your patch is mainly about that part of the guideline, it is addressing the documentation update in a wrong order, creating possibly a wasted work.
Re: [PATCH] branch: adjust documentation
Quoted 4 lines · Junio C Hamano
Do not forget that the objective of the larger-picture-revamping of this page is to make the description of each option self-contained. Similarity between -m's description and -c's description does not count as being uselessly repetitive.
OK. I was not considering this.
Thanks.
Re: [PATCH] branch: adjust documentation
Quoted 8 lines · Rubén Justo
Quoted 4 lines · Junio C Hamano
Do not forget that the objective of the larger-picture-revamping of this page is to make the description of each option self-contained. Similarity between -m's description and -c's description does not count as being uselessly repetitive.
OK. I was not considering this.
I'd also like to avoid repetition, but if we want to have self-contained command descriptions (which is good), some repetition is unavoidable. In fact, we can see what avoiding the repetition has lead us to in the current state of the git-branch(1) man page.
Re: [PATCH] branch: adjust documentation
Quoted 8 lines · Dragan Simic
Quoted 7 lines · Rubén Justo
Quoted 4 lines · Junio C Hamano
Do not forget that the objective of the larger-picture-revamping of this page is to make the description of each option self-contained. Similarity between -m's description and -c's description does not count as being uselessly repetitive.
Quoted 4 lines
Quoted 1 line
OK. I was not considering this.
I'd also like to avoid repetition, but if we want to have self-contained command descriptions (which is good), some repetition is unavoidable.
I don't see much of a problem with repetitions. Within the self-containmnent aspect it makes a lot of sense. And, after all, my messages have been mainly about repeating ... placeholders.
Quoted 2 lines
In fact, we can see what avoiding the repetition has lead us to in the current state of the git-branch(1) man page.
Indeed. I agree that the lack of repetition has brought us here. But I think we're not 100% aligned in what repetition is :-), yet. We're working on it!
Thanks.
Quoted 16 lines · Junio C Hamano
Quoted 5 lines · Dragan Simic
Quoted 1 line
My advice would be to stick to <old> vs <new> that contrasts well.
I appreciate the directness and honesty. How about using "<oldbranch>" and "<newbranch>" instead, which, although more wordy, would be more consistent with "<branch>" that's used in a number of other places?
I have slight aversion to non-words like "oldbranch" (not "old-branch"), but not that much.
Quite honestly, in a document whose primary topic is "branch", I doubt that repeating "branch" all over the place would be the consistency we should be aiming for in the first place, when it is clear from the context that we are talking about branches.
Quoted 10 lines
The updates we are making to
Documentation/git-branch.txtthat (1) slims wordy description of different modes in the DESCRIPTION section, (2) make option description of "-m" mention what argument(s) the option takes, and (3) rmove standalone <newbranch> and <oldbranch> description are all about making the necessary piece of information easier to find in one place (namely, the option description where "-m [<one branch name>] [<the other branch name>]" is described) without having to jump around all over in the documentation, so in that sense, I would think the way to go is to aim for brevity that takes advantage of the local context.
It's hard not to agree with the way you laid this out. :)
In a nutshell, the way I see it, using "<old>" and "<new>" is also fine. It's also fine with me to use "<name>" instead of "<branch>"; in fact, if we go with "<old>" and "<new>", we should go with "<name>", too.
Quoted 10 lines · Dragan Simic
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.
Sorry, but I don't. Actually, I don't see the logic with <destination>.
I appreciate your efforts to provide consistency, but the current ones seem better options to me: either <oldbranch> and <newbranch>, or the shortened ones: <old> and <new>.
Thanks.
Quoted 8 lines · Rubén Justo
Quoted 6 lines · Dragan Simic
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>
Quoted 6 lines
Quoted 4 lines
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.
Sorry, but I don't. Actually, I don't see the logic with <destination>.
No worries, I appreciate the directness.
Quoted 3 lines
I appreciate your efforts to provide consistency, but the current ones seem better options to me: either <oldbranch> and <newbranch>, or the shortened ones: <old> and <new>.
As I wrote a bit earlier, while replying to Junio, using "<old>" and "<new>" (together with "<name>") is fine with me.
Though, using "<branch>" and "<new-branch>" is also a very good option, which would additionally avoid introducing "<name>" to replace "<branch>", which I find highly beneficial, because it would provide consistency with the rest of the documentation.
Hello Ruben and Junio,
Quoted 7 lines · Rubén Justo
Quoted 3 lines · Dragan Simic
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.
Thank you, and everyone else, for the reviews and suggestions.
Quoted 8 lines
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, I'd agree with Junio's reply that suggested using even shorter terms. Just like "<oldbranch>" and "<newbranch>" can safely be shortened to "<old>" and "<new>", respectively, "<branchname>" can also be shortened to "<name>".
It's all about the context, which is improved by moving the descriptions of the arguments closer to the descriptions of the commands.
Though, I'd prefer that we keep "<oldbranch>" and "<newbranch>" (and "<branchname>") for now, for the sake of consistency, and I'd get them shortened in the future patches.
Quoted 128 lines
Quoted 128 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/[email protected]/T/#u
[2] https://lore.kernel.org/git/[email protected]/T/#uSigned-off-by Dragan Simic <[email protected]>---
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.Documentation/git-branch.txt | 44 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 26 deletions(-)Documentation/git-branch.txt +0
-0@@ -72,16 +72,6 @@ the remote-tracking branch. This behavior may bechanged via the global
overridden by using the--trackand--no-trackoptions, and changed later usinggit branch --set-upstream-to.-With a
-mor-Moption, <oldbranch> will be renamed to <newbranch>.Documentation/git-branch.txt +0
-7-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 copiedto a
Documentation/git-branch.txt +0
-2-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 checkedout
in another worktree linked to the same repository.--m::
---move::Documentation/git-branch.txt +3
-1- Move/rename a branch, together with its config and reflog. +-m [<oldbranch>] <newbranch>:: +--move [<oldbranch>] <newbranch>:: + Rename an existing branch <oldbranch>, which if not specifieddefaults
Documentation/git-branch.txt +2
-0+ to the current branch, to <newbranch>. The configuration variables + for the <oldbranch> branch and its reflog are also renamedappropriately
Documentation/git-branch.txt +2
-0+ to be used with <newbranch>. Renaming fails if branch <newbranch> + already exists, but you can use `-M` or `--move --force` tooverwrite
Documentation/git-branch.txt +7
-4+ 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 copiedappropriately
Documentation/git-branch.txt +2
-0+ to be used with <newbranch>. Copying fails if branch <newbranch> + already exists, but you can use `-C` or `--copy --force` tooverwrite
Documentation/git-branch.txt +2
-1+ 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 thesubmodule's "origin/main".
Documentation/git-branch.txt +0
-8given 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
Quoted 19 lines · Dragan Simic
Hello Ruben and Junio,
Quoted 9 lines · Rubén Justo
Quoted 5 lines · Dragan Simic
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.
Thank you, and everyone else, for the reviews and suggestions.
Quoted 4 lines
Let me chime in just to say that maybe another terms could be considered here; like: "<branchname>" and "<newbranchname>" (maybe too long...) or so.
Quoted 7 lines
Quoted 4 lines
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, I'd agree with Junio's reply that suggested using even shorter terms.
Me too :-)
Quoted 6 lines
Just like "<oldbranch>" and "<newbranch>" can safely
be shortened to "<old>" and "<new>", respectively, "<branchname>" can also be shortened to "<name>".It's all about the context, which is improved by moving the descriptions of the arguments closer to the descriptions of the commands.
Your series is an improvement in that respect. Thank you.
Quoted 4 lines
Though, I'd prefer that we keep "<oldbranch>" and "<newbranch>" (and "<branchname>") for now, for the sake of consistency, and I'd get them shortened in the future patches.
Nice!
Quoted 33 lines · Dragan Simic
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/[email protected]/T/#u
[2] https://lore.kernel.org/git/[email protected]/T/#uSigned-off-by Dragan Simic <[email protected]>---
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.
Quoted 4 lines
Documentation/git-branch.txt | 44 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 26 deletions(-)
Thanks! I think this is a great improvement to this document.
Quoted 23 lines
Documentation/git-branch.txt +0
-10@@ -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.
Documentation/git-branch.txt Note that 'git branch -f <branchname> [<start-point>]', even with '-f', · line 124
Quoted 10 lines
Documentation/git-branch.txt +4
-3@@ -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.
Quoted 42 lines
Documentation/git-branch.txt +14
-13+ 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
Hello Kyle,
Quoted 41 lines · Kyle Lippincott
Quoted 40 lines · Dragan Simic
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/[email protected]/T/#u
[2] https://lore.kernel.org/git/[email protected]/T/#uSigned-off-by Dragan Simic <[email protected]>---
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.
Quoted 8 lines
Quoted 6 lines
[3]Documentation/git-branch.txt | 44 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 26 deletions(-)Thanks! I think this is a great improvement to this document.
Thank you, I'm glad that you like it. :)
Quoted 30 lines
Quoted 30 lines
Documentation/git-branch.txt +0
-0@@ -72,16 +72,6 @@ the remote-tracking branch. This behavior may bechanged via the global
overridden by using the--trackand--no-trackoptions, and changed later usinggit branch --set-upstream-to.-With a
-mor-Moption, <oldbranch> will be renamed to <newbranch>.Documentation/git-branch.txt +0
-7-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 copiedto a
Documentation/git-branch.txt +0
-2-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 checkedout
in another worktree linked to the same repository.
Quoted 16 lines
Quoted 9 lines
--m::
---move::Documentation/git-branch.txt +3
-1- Move/rename a branch, together with its config and reflog. +-m [<oldbranch>] <newbranch>:: +--move [<oldbranch>] <newbranch>:: + Rename an existing branch <oldbranch>, which if not specifieddefaults
+ to the current branch, to <newbranch>. The configuration
variablesVery 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/CodingGuidelinessuggesting 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.
In this case, I went with following the intersentence spacing used in the surrounding text. Though, my brain and muscle memory are kind of hardcoded to use double spacing, which may not be as prevalent as a while ago, but IMHO makes reading text rendered using a fixed-width font much easier. I can adjust if needed, of course.
Quoted 52 lines
Quoted 52 lines
+ 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-Mor--move --forceto
overwriteDocumentation/git-branch.txt +5
-4+ 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 specifieddefaults
+ 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-Cor--copy --forceto
overwriteDocumentation/git-branch.txt +2
-1+ 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 thesubmodule'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>::
Documentation/git-branch.txt +0
-5- 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 asfor
Documentation/git-branch.txt +0
-2- <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
Quoted 114 lines · Dragan Simic
Hello Kyle,
Quoted 51 lines · Kyle Lippincott
Quoted 49 lines · Dragan Simic
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/[email protected]/T/#u
[2] https://lore.kernel.org/git/[email protected]/T/#uSigned-off-by Dragan Simic <[email protected]>---
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.Quoted 8 lines
Quoted 6 lines
[3]Documentation/git-branch.txt | 44 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 26 deletions(-)Thanks! I think this is a great improvement to this document.
Thank you, I'm glad that you like it. :)
Quoted 31 lines
Quoted 31 lines
Documentation/git-branch.txt +0
-0@@ -72,16 +72,6 @@ the remote-tracking branch. This behavior may bechanged via the global
overridden by using the--trackand--no-trackoptions, and changed later usinggit branch --set-upstream-to.-With a
-mor-Moption, <oldbranch> will be renamed to <newbranch>.Documentation/git-branch.txt +0
-7-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 copiedto a
Documentation/git-branch.txt +0
-2-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 checkedout
in another worktree linked to the same repository.Quoted 16 lines
Quoted 9 lines
--m::
---move::Documentation/git-branch.txt +3
-1- Move/rename a branch, together with its config and reflog. +-m [<oldbranch>] <newbranch>:: +--move [<oldbranch>] <newbranch>:: + Rename an existing branch <oldbranch>, which if not specifieddefaults
+ to the current branch, to <newbranch>. The configuration
variablesVery 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/CodingGuidelinessuggesting 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.
Quoted 6 lines
In this case, I went with following the intersentence spacing used in the surrounding text. Though, my brain and muscle memory are kind of hardcoded to use double spacing, which may not be as prevalent as a while
ago, but IMHO makes reading text rendered using a fixed-width font much easier. I can adjust if needed, of course.
No need to adjust if I'm the only one mentioning it. I'm very new to the project, so please don't take my style nits as any sort of mandate, since I'm the one that's most likely to be miscalibrated. :)
Quoted 53 lines
Quoted 53 lines
Quoted 53 lines
+ 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-Mor--move --forceto
overwriteDocumentation/git-branch.txt +5
-4+ 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 specifieddefaults
+ 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-Cor--copy --forceto
overwriteDocumentation/git-branch.txt +2
-1+ 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 thesubmodule'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>::
Documentation/git-branch.txt +0
-5- 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 asfor
Documentation/git-branch.txt +0
-2- <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
Quoted 16 lines · Kyle Lippincott
Quoted 8 lines · Dragan Simic
Quoted 6 lines · Kyle Lippincott
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/CodingGuidelinessuggesting 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.Quoted 6 lines
In this case, I went with following the intersentence spacing used in the surrounding text. Though, my brain and muscle memory are kind of hardcoded to use double spacing, which may not be as prevalent as a while
ago, but IMHO makes reading text rendered using a fixed-width font much easier. I can adjust if needed, of course.
Quoted 3 lines
No need to adjust if I'm the only one mentioning it. I'm very new to the project, so please don't take my style nits as any sort of mandate, since I'm the one that's most likely to be miscalibrated. :)
Basically, when it comes to the intersentence spacing, it seems that double spacing has lost its popularity over time. It originates from the old times when mechanical typewriters were used, which most people probably don't even remember these days. :)