git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Carl Worth <cworth@cworth.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Matthias Lederhofer <matled@gmx.net>, git@vger.kernel.org
Subject: Re: [PATCH] git-checkout: disable guides how to switch branches with ui.guide
Date: Thu, 01 Feb 2007 13:34:10 -0800	[thread overview]
Message-ID: <87ps8ta7fx.wl%cworth@cworth.org> (raw)
In-Reply-To: <7vabzxoaed.fsf@assigned-by-dhcp.cox.net>

[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]

On Thu, 01 Feb 2007 13:06:34 -0800, Junio C Hamano wrote:
> The error message you quoted is given when your head is detached
> and you tried the regular "checkout an existing branch" -- which
> will lose where your detached HEAD currently is.

I think the problem with this is that git tells the user so little
information, ("may lose your changes"). What changes? Is that dirty
state?  Some commits? Hmm... have I committed anything? Why can't git
be sure about what this operation is going to do?

I think a really useful message would be something like:

	You are not on any branch so switching to branch 'foo'
	will cause the following commits to be lost:

		ba531642 A commit headline here...
		b1189118 Another commit headline here...

	Refusing to checkout 'foo'.

Didn't a bunch of work get committed to make the reachability analysis
feasible to generate a message like this?

If there are no commits that would become dangling, then the checkout
should just proceed. As for the concern about losing a pointer to some
"valuable" state that will still technically be reachable, but might
be hard to get back, why not just print a message along the lines of:

	Leaving commit 7b1509f4 to checkout 'foo'.

(or just depend on the HEAD reflog).

-Carl

PS. If nothing else gets changed in the current message, please
reconsider the current wording of:

	Leaving your HEAD detached; not switching to branch 'foo'.

Think: Wow, I had heard that git might help me shoot myself in the
foot, but I never though I might behead myself with it.

It would probably work to just reword that as:

	Not switching to branch 'foo'.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2007-02-01 21:34 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-31 19:10 [PATCH] tone down the detached head warning Nicolas Pitre
2007-01-31 23:19 ` Jeff King
2007-01-31 23:25   ` Jakub Narebski
2007-01-31 23:27     ` Jeff King
2007-01-31 23:33       ` Jakub Narebski
2007-01-31 23:54   ` Carl Worth
2007-02-01  0:14     ` Jakub Narebski
2007-02-01  8:44       ` Andy Parkins
2007-02-01 12:48         ` Matthias Lederhofer
2007-02-01  0:11   ` Nicolas Pitre
2007-02-01  3:00     ` Jeff King
2007-02-01  3:23       ` Junio C Hamano
2007-02-01  3:29         ` Jeff King
2007-02-01  3:47           ` Nicolas Pitre
2007-02-01  3:54             ` Jeff King
2007-02-01  9:08         ` [PATCH] detached HEAD -- finishing touches Junio C Hamano
2007-02-01  9:46           ` Raimund Bauer
2007-02-01  9:53           ` Alex Riesen
2007-02-01  9:54             ` Alex Riesen
2007-02-01 18:44           ` [PATCH] git-checkout: disable guides how to switch branches with ui.guide Matthias Lederhofer
2007-02-01 20:42             ` Junio C Hamano
2007-02-01 20:51               ` Matthias Lederhofer
2007-02-01 21:06                 ` Junio C Hamano
2007-02-01 21:23                   ` Matthias Lederhofer
2007-02-01 21:34                   ` Carl Worth [this message]
2007-02-01 21:59                     ` Nicolas Pitre
2007-02-01 22:16                       ` Carl Worth
2007-02-01 23:18                         ` Jakub Narebski
2007-02-01 21:52           ` [PATCH] detached HEAD -- finishing touches Theodore Tso
2007-02-02  1:11             ` Junio C Hamano
2007-02-02  1:16               ` Theodore Tso
2007-02-02  1:27               ` Carl Worth
2007-02-02  1:30                 ` Junio C Hamano
2007-02-02  1:46                   ` Carl Worth
2007-02-02  2:38                     ` 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=87ps8ta7fx.wl%cworth@cworth.org \
    --to=cworth@cworth.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=matled@gmx.net \
    /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).