git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yutaro Ohno via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Yutaro Ohno <yutaro.ono.418@gmail.com>,
	Yutaro Ohno <yutaro.ono.418@gmail.com>
Subject: [PATCH] doc: use "git switch -c" rather than "git checkout -b" consistently
Date: Sun, 08 Jan 2023 08:24:01 +0000	[thread overview]
Message-ID: <pull.1422.git.git.1673166241185.gitgitgadget@gmail.com> (raw)

From: Yutaro Ohno <yutaro.ono.418@gmail.com>

In the "DETACHED HEAD" section in the git-checkout doc, it suggests
using "git checkout -b <branch-name>" to create a new branch on the
detached head.

On the other hand, when you checkout a commit that is not at the tip of
any named branch (e.g., when you checkout a tag), git suggests using
"git switch -c <branch-name>".

Use "git switch -c" and fix this inconsistency.

Signed-off-by: Yutaro Ohno <yutaro.ono.418@gmail.com>
---
    doc: use "git switch -c" rather than "git checkout -b" consistently

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1422%2Fohno418%2Fimprove-git-checkout-doc-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1422/ohno418/improve-git-checkout-doc-v1
Pull-Request: https://github.com/git/git/pull/1422

 Documentation/git-checkout.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 4cb9d555b4b..ba3d6164847 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -477,9 +477,9 @@ before that happens. If we have not yet moved away from commit `f`,
 any of these will create a reference to it:
 
 ------------
-$ git checkout -b foo   <1>
-$ git branch foo        <2>
-$ git tag foo           <3>
+$ git switch -c foo   <1>
+$ git branch foo      <2>
+$ git tag foo         <3>
 ------------
 
 <1> creates a new branch `foo`, which refers to commit `f`, and then

base-commit: 2b4f5a4e4bb102ac8d967cea653ed753b608193c
-- 
gitgitgadget

             reply	other threads:[~2023-01-08  8:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-08  8:24 Yutaro Ohno via GitGitGadget [this message]
2023-01-09  4:30 ` [PATCH] doc: use "git switch -c" rather than "git checkout -b" consistently Junio C Hamano
2023-01-09  4:48   ` Eric Sunshine
2023-01-09  6:30     ` Junio C Hamano
2023-01-09  6:32       ` Eric Sunshine
2023-01-09  8:47         ` Yutaro Ohno
2023-01-09 11:17   ` rsbecker
2023-01-09 19:16     ` Eric Sunshine
2023-01-09 19:58       ` rsbecker
2023-01-09 21:08         ` Eric Sunshine
2023-01-09 21:24           ` Ævar Arnfjörð Bjarmason
2023-01-09 10:47 ` [PATCH v2] doc: add "git switch -c" as another option on detached HEAD Yutaro Ohno via GitGitGadget
2023-01-09 19:53   ` Eric Sunshine
2023-01-13 17:58     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1422.git.git.1673166241185.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=yutaro.ono.418@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).