{"thread":{"id":"60570","subject":"[PATCH] Mention default oldbranch in git-branch doc","startedAt":"2023-11-30T00:24:54Z","lastAt":"2023-12-01T01:25:56Z","messageCount":2,"participants":["Clarence Sparr Risher via GitGitGadget","Rubén Justo"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"485254","messageId":"pull.1613.git.git.1701303891791.gitgitgadget@gmail.com","threadId":"60570","inReplyTo":null,"subject":"[PATCH] Mention default oldbranch in git-branch doc","fromName":"Clarence Sparr Risher via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-11-30T00:24:51Z","receivedAt":"2023-11-30T00:24:54Z","isPatch":true,"sender":{"key":"name:Clarence Sparr Risher","avatar":null},"body":"From: \"Clarence \\\"Sparr\\\" Risher\" <sparr0@gmail.com>\n\n`git branch -m` has an optional first argument, the branch to rename.\nIf omitted, it defaults to the current branch. This behavior is not\ncurrently described in the documentation. While it can be determined\nrelatively easily through experimentation, and less so through viewing\nthe source code (builtin/branch.c:897), it is not obvious what such a\ncommand will do when encountered in a less interactive context.\n\nThis patch adds one sentence to the git-branch documentation, with\nwording based on another optional argument described earlier in the\nsame doc.\n\nThe same behavior applies to -M, -c, and -C, which are all covered by\nthis same section of the documentation.\n\nSigned-off-by: Clarence Risher <clarence@kira-learning.com>\nSigned-off-by: Clarence \"Sparr\" Risher <sparr0@gmail.com>\n---\n    Mention default oldbranch in git-branch doc\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1613%2Fsparr%2Fdoc_branch_rename_one_param-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1613/sparr/doc_branch_rename_one_param-v1\nPull-Request: https://github.com/git/git/pull/1613\n\n Documentation/git-branch.txt | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 4395aa93543..affed1b17a4 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -73,6 +73,7 @@ overridden by using the `--track` and `--no-track` options, and\n changed later using `git branch --set-upstream-to`.\n \n With a `-m` or `-M` option, <oldbranch> will be renamed to <newbranch>.\n+If the <oldbranch> argument is missing it defaults to the current branch.\n If <oldbranch> had a corresponding reflog, it is renamed to match\n <newbranch>, and a reflog entry is created to remember the branch\n renaming. If <newbranch> exists, -M must be used to force the rename\n\nbase-commit: 564d0252ca632e0264ed670534a51d18a689ef5d\n-- \ngitgitgadget\n"},{"id":"485296","messageId":"ba8c814c-cb93-49cb-9df0-8f4599e68e9e@gmail.com","threadId":"60570","inReplyTo":"pull.1613.git.git.1701303891791.gitgitgadget@gmail.com","subject":"Re: [PATCH] Mention default oldbranch in git-branch doc","fromName":"Rubén Justo","fromEmail":"rjusto@gmail.com","sentAt":"2023-12-01T01:25:26Z","receivedAt":"2023-12-01T01:25:56Z","isPatch":true,"sender":{"key":"rjusto@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5685487?v=4"},"body":"On 30-nov-2023 00:24:51, Clarence \"Sparr\" Risher via GitGitGadget wrote:\n> From: \"Clarence \\\"Sparr\\\" Risher\" <sparr0@gmail.com>\n> \n> `git branch -m` has an optional first argument, the branch to rename.\n> If omitted, it defaults to the current branch. This behavior is not\n> currently described in the documentation.\n\nGood catch.\n\n> While it can be determined\n> relatively easily through experimentation, and less so through viewing\n> the source code (builtin/branch.c:897)\n\nSome people will find it easier by reading the code than through\nexperimentation ;-)\n\n> it is not obvious what such a\n> command will do when encountered in a less interactive context.\n\nCertainly, I agree.\n\n> \n> This patch adds one sentence to the git-branch documentation, with\n> wording based on another optional argument described earlier in the\n> same doc.\n> \n> The same behavior applies to -M, -c, and -C\n\nGood.\n\n> \n> Signed-off-by: Clarence Risher <clarence@kira-learning.com>\n> Signed-off-by: Clarence \"Sparr\" Risher <sparr0@gmail.com>\n\nAre you both?  If that is the case, IMO it is unusual in this project to\nhave two different signatures for the same person in one commit.\n\n> \n> diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\n> index 4395aa93543..affed1b17a4 100644\n> --- a/Documentation/git-branch.txt\n> +++ b/Documentation/git-branch.txt\n> @@ -73,6 +73,7 @@ overridden by using the `--track` and `--no-track` options, and\n>  changed later using `git branch --set-upstream-to`.\n>  \n>  With a `-m` or `-M` option, <oldbranch> will be renamed to <newbranch>.\n> +If the <oldbranch> argument is missing it defaults to the current branch.\n\nSounds good.  But IMHO this information fits better below, where the\nterm \"<oldbranch>\" is described.  Something like:\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 4395aa9354..9c17df9f4d 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -312,7 +312,8 @@ superproject's \"origin/main\", but tracks the submodule's \"origin/main\".\n        option is omitted, the current HEAD will be used instead.\n\n <oldbranch>::\n-       The name of an existing branch to rename.\n+       The name of an existing branch to rename or copy.  If this\n+       option is omitted, the current branch will be used instead.\n\nCompleting while we're here, what we missed when -c was introduced in\n52d59cc645 (branch: add a --copy (-c) option to go with --move (-m),\n2017-06-18).\n\n>  If <oldbranch> had a corresponding reflog, it is renamed to match\n>  <newbranch>, and a reflog entry is created to remember the branch\n>  renaming. If <newbranch> exists, -M must be used to force the rename\n> \n> base-commit: 564d0252ca632e0264ed670534a51d18a689ef5d\n> -- \n> gitgitgadget\n\n\nThank you for working on this.\n"}]}