All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ed Avis <ed.avis@qmaw.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git switch error message tweak
Date: Wed, 17 Jun 2020 13:30:36 -0700	[thread overview]
Message-ID: <xmqq8sgltoyb.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <BL0PR11MB34603334FD8AF4B662A74C3A9D9D0@BL0PR11MB3460.namprd11.prod.outlook.com> (Ed Avis's message of "Tue, 16 Jun 2020 06:47:03 +0000")

Ed Avis <ed.avis@qmaw.com> writes:

> 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.

Excellent.

> 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'd say you are correct---one who passes "--detach" knows enough to
want to be in the detached HEAD state and knows enough that the
state is nothing to be worried about.

      reply	other threads:[~2020-06-17 20:30 UTC|newest]

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

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=xmqq8sgltoyb.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.