From: Yutaro Ohno Date: Mon, 9 Jan 2023 10:47:17 +0000 (+0000) Subject: doc: add "git switch -c" as another option on detached HEAD X-Git-Tag: v2.40.0-rc0~74^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e37969e4b1ef56a2fae6cdf7d5d082c449be1b8;p=thirdparty%2Fgit.git 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 " 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 ". Add "git switch -c" as another option and mitigate this inconsistency. Signed-off-by: Yutaro Ohno Acked-by: Eric Sunshine Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 4cb9d555b4..9f116acdbd 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 checkout -b foo # or "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