git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ed Avis <ed.avis@qmaw.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: git switch error message tweak
Date: Tue, 16 Jun 2020 06:47:03 +0000	[thread overview]
Message-ID: <BL0PR11MB34603334FD8AF4B662A74C3A9D9D0@BL0PR11MB3460.namprd11.prod.outlook.com> (raw)

To help those migrating from 'git checkout' to the newer 'git switch'
and 'git restore', this error message could be improved:

% git switch baa022666d26a5d40e86c0b6349eb7435033e80a
fatal: a branch is expected, got commit 'baa022666d26a5d40e86c0b6349eb7435033e80a'

It could print additionally

To switch to this commit in 'detached HEAD' mode, use --detach.

as long as it was indeed a commit that was given.

I note also that while git checkout prints a spiel about "You are in
'detached HEAD' state", git switch --detach does not.  Was this
deliberate, on the assumption that if you pass --detach you know what
you are doing?  I think it might be better to honour the
advice.detachedHead setting the same way for both checkout and switch.

Thanks for considering this request, and apologies if this is something already discussed and decided.

-- 
Ed Avis <ed.avis@qmaw.com>

             reply	other threads:[~2020-06-16  6:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16  6:47 Ed Avis [this message]
2020-06-17 20:30 ` git switch error message tweak 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=BL0PR11MB34603334FD8AF4B662A74C3A9D9D0@BL0PR11MB3460.namprd11.prod.outlook.com \
    --to=ed.avis@qmaw.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).