Users who are accustomed to doing `git checkout <tag>` assume that `git switch <tag>` will do the same thing. Inform them of the --detach option so they aren't left wondering why `git switch` doesn't work but `git checkout` does. Signed-off-by: Alex Henrie <alexhenrie24@xxxxxxxxx> --- builtin/checkout.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builtin/checkout.c b/builtin/checkout.c index d9b31bbb6d..10a035feed 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1398,6 +1398,10 @@ static void die_expecting_a_branch(const struct branch_info *branch_info) struct object_id oid; char *to_free; + if (advice_enabled(ADVICE_DETACHED_HEAD)) + advise(_("The specified commit is not a local branch.\n" + "If you want to enter detached head mode, try again with the --detach option.")); + if (dwim_ref(branch_info->name, strlen(branch_info->name), &oid, &to_free, 0) == 1) { const char *ref = to_free; -- 2.35.1