doc: add "git switch -c" as another option on detached HEAD

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>". Add "git switch -c" as another option and mitigate this inconsistency. Signed-off-by: Yutaro Ohno <yutaro.ono.418@gmail.com> Acked-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Yutaro Ohno committed Jan 9, 2023 at 10:47 UTC 9e37969e4b1ef56a2fae6cdf7d5d082c449be1b8
1 file changed +3 -3
Documentation/git-checkout.txt
+3 -3
@@ -477,9 +477,9 @@ before that happens. If we have not yet moved away from commit `f`,
477 any of these will create a reference to it:
478
479 ------------
480 -$ git checkout -b foo <1>
481 -$ git branch foo <2>
482 -$ git tag foo <3>
480 +$ git checkout -b foo # or "git switch -c foo" <1>
481 +$ git branch foo <2>
482 +$ git tag foo <3>
483 ------------
484
485 <1> creates a new branch `foo`, which refers to commit `f`, and then