From: Mark Lodato <lodatom@gmail.com>
To: Nicolas Pitre <nico@fluxnic.net>
Cc: Junio C Hamano <gitster@pobox.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
Git List <git@vger.kernel.org>, Ron1 <ron1@flownet.com>,
Jacob Helwig <jacob.helwig@gmail.com>
Subject: Re: master^ is not a local branch -- huh?!?
Date: Fri, 29 Jan 2010 22:59:49 -0500 [thread overview]
Message-ID: <ca433831001291959m76ed6adap32a17c10e465af1f@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1001292208470.1681@xanadu.home>
On Fri, Jan 29, 2010 at 10:11 PM, Nicolas Pitre <nico@fluxnic.net> wrote:
> On Fri, 29 Jan 2010, Mark Lodato wrote:
>> On Fri, Jan 29, 2010 at 8:22 PM, Nicolas Pitre <nico@fluxnic.net> wrote:
>> > On Fri, 29 Jan 2010, Mark Lodato wrote:
>> >
>> >> Still, I find it slightly confusing and unfriendly. How about the following?
>> >
>> >> Checking out commit 'master^0'.
>> >>
>> >> Since this is not a local branch head, any commits you make will be lost
>> >> when you check out another branch or commit. (In git terminology, HEAD
>> >> is detached.) If you just wish to look at files without committing,
>> >> this is fine. If you wish to make commits and retain them, you may
>> >> create a new branch by running:
>> >>
>> >> git checkout -b <new_branch_name>
>> >
>> > This gives the impression that any commit you make on a detached HEAD
>> > are going to be lost, unless you create a new branch first.
>>
>> What about "...you may want to create..."? This does not imply that
>> creating a new branch now is the *only* way, just the most likely. If
>> a user knows another way, that user probably does not need this
>> warning in the first place.
>
> Still, you don't know what way the unsuspected user will take to get
> there.
Sorry, I don't understand. What do you mean by "take to get there"?
Are you referring to how the user arrived in this detached HEAD state,
or what the user wishes to do next? Either way, I still am not sure
why this wording is no good. Could please elaborate?
> Do you still have a problem with the latest version of the text from
> Junio? Looks like you based your modification on an earlier version.
Yes, I do. I thought his earlier version was more clear. Particularly:
Note: 'master^0' isn't a local branch head;
This isn't very friendly. It sounds like an admonition. Rather, I
suggest that the first sentence be similar to, but distinct from,
"Switched to branch foo," to inform the user that they did something
different, which may or may not be intentional.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by checking out another branch.
First, we shouldn't start off with the term "detached HEAD". I used a
parenthetical comment to mention it, in case the user wants to look it
up or refer to this state. Otherwise, the term conveys no meaning,
unless one understand enough about git to not need this advice.
Second, this advice should be a warning that commits may be lost
unless one knows what one is doing. Saying "you can discard commits"
makes it sound like a feature! Sure, that may be so for advanced
users, but for beginners (for whom this advice is intended), this is a
common trap. I tried to word the advice so that the users will know
that they should not commit without first creating a branch (or
knowing what they're doing), but that if they don't commit, there's no
problem. The wording quoted above does not convey this meaning to me.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new_branch_name>
I basically retained this, with rewording.
This discussion brings up another good point: The main worry about a
detached head is losing commits. Back in 2008, it was suggested to
have a warning when committing on a detached HEAD:
http://kerneltrap.org/mailarchive/git/2008/9/2/3169744
This was before the advice system, so folks complained about it
getting in the way, and it was never implemented. Since we now have a
way to easily turn off the warning, perhaps we should bring this topic
up again (probably as a separate thread.)
next prev parent reply other threads:[~2010-01-30 4:00 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 20:20 master^ is not a local branch -- huh?!? Ron1
2010-01-29 20:27 ` Jacob Helwig
2010-01-29 20:35 ` Sverre Rabbelier
2010-01-29 20:38 ` Jacob Helwig
2010-01-29 20:48 ` Junio C Hamano
2010-01-29 20:56 ` Sverre Rabbelier
2010-01-29 21:09 ` [PATCH] checkout: warn about 'branch name' rather than 'local branch' Sverre Rabbelier
2010-01-29 21:19 ` [PATCH] checkout: Fix test for s/local branch/branch name/ change Jacob Helwig
2010-01-29 21:20 ` Sverre Rabbelier
2010-01-29 21:40 ` [PATCH] checkout: warn about 'branch name' rather than 'local branch' Nicolas Pitre
2010-01-29 21:50 ` Ron Garret
2010-01-29 21:42 ` Junio C Hamano
2010-01-29 21:45 ` Sverre Rabbelier
2010-01-29 21:35 ` master^ is not a local branch -- huh?!? Junio C Hamano
2010-01-29 21:20 ` Nicolas Pitre
2010-01-29 21:21 ` Sverre Rabbelier
2010-01-29 21:29 ` Nicolas Pitre
2010-01-29 21:32 ` Sverre Rabbelier
2010-01-29 21:51 ` Nicolas Pitre
2010-01-29 21:58 ` Junio C Hamano
2010-01-29 22:00 ` Sverre Rabbelier
2010-01-29 22:34 ` Nicolas Pitre
2010-01-29 22:39 ` Junio C Hamano
2010-01-29 22:46 ` Jacob Helwig
2010-01-29 23:43 ` Nicolas Pitre
2010-01-30 0:14 ` Junio C Hamano
2010-01-30 0:18 ` Sverre Rabbelier
2010-01-30 0:29 ` Junio C Hamano
2010-01-30 0:35 ` Sverre Rabbelier
2010-01-30 0:38 ` Michael Witten
2010-01-30 0:39 ` Nicolas Pitre
2010-01-30 1:01 ` Mark Lodato
2010-01-30 1:22 ` Nicolas Pitre
2010-01-30 2:38 ` Ron Garret
2010-01-30 2:59 ` Junio C Hamano
2010-01-30 3:26 ` Ron Garret
2010-01-30 4:03 ` Nicolas Pitre
2010-01-30 5:06 ` Jay Soffian
2010-01-30 5:09 ` Junio C Hamano
2010-01-30 4:52 ` Jay Soffian
2010-01-30 5:15 ` Nicolas Pitre
2010-01-30 5:21 ` Junio C Hamano
2010-01-30 6:25 ` Ron Garret
2010-01-30 18:25 ` Junio C Hamano
2010-01-30 5:45 ` Jay Soffian
2010-01-30 5:18 ` Junio C Hamano
2010-01-30 6:23 ` Ron Garret
2010-01-30 2:40 ` Mark Lodato
2010-01-30 3:11 ` Nicolas Pitre
2010-01-30 3:59 ` Mark Lodato [this message]
2010-01-30 4:39 ` Nicolas Pitre
2010-01-30 5:05 ` Nicolas Pitre
2010-01-30 5:11 ` Jay Soffian
2010-01-30 5:25 ` Nicolas Pitre
2010-01-30 5:53 ` Mark Lodato
2010-01-30 6:03 ` Junio C Hamano
2010-01-30 8:59 ` Jeff King
2010-01-30 18:40 ` Ron Garret
2010-01-29 23:16 ` A Large Angry SCM
2010-01-29 21:49 ` Junio C Hamano
2010-01-30 2:13 ` Johannes Schindelin
2010-01-30 3:15 ` Nicolas Pitre
2010-01-29 20:35 ` Johannes Schindelin
2010-01-29 21:16 ` Ron1
2010-01-29 21:25 ` Jacob Helwig
2010-01-29 21:43 ` Ron Garret
2010-01-29 21:59 ` Junio C Hamano
2010-01-29 22:18 ` Ron Garret
2010-01-31 7:32 ` Junio C Hamano
2010-01-29 20:32 ` Octavio Alvarez
2010-01-29 21:34 ` Ron Garret
2010-01-29 22:32 ` Octavio Alvarez
2010-01-29 22:47 ` Ron Garret
2010-01-29 23:05 ` Octavio Alvarez
2010-01-29 23:12 ` Junio C Hamano
2010-01-29 23:30 ` Ron Garret
2010-01-29 23:28 ` Julian Phillips
2010-01-30 0:14 ` Ron Garret
2010-01-30 0:18 ` Ron Garret
2010-01-30 19:02 ` Junio C Hamano
2010-01-30 19:24 ` Ron Garret
2010-01-29 20:36 ` Scott R. Godin
2010-01-29 21:24 ` Ron Garret
2010-01-29 21:28 ` Sverre Rabbelier
2010-01-29 21:40 ` Ron Garret
2010-01-29 21:54 ` Junio C Hamano
2010-01-29 22:12 ` Ron Garret
2010-01-30 0:33 ` Michael Witten
2010-01-30 3:06 ` Junio C Hamano
2010-01-30 6:16 ` Ron Garret
2010-01-30 6:45 ` Junio C Hamano
2010-01-30 7:31 ` Ron Garret
2010-01-30 8:02 ` Junio C Hamano
2010-01-30 8:56 ` Ron Garret
-- strict thread matches above, loose matches on Subject: below --
2010-02-01 11:52 Steve Diver
2010-02-01 17:38 ` Junio C Hamano
2010-02-01 17:58 ` Sergei Organov
2010-02-01 22:52 ` Ron Garret
2010-02-01 23:01 ` Petr Baudis
2010-02-01 23:25 ` Nicolas Pitre
2010-02-01 23:37 ` Junio C Hamano
2010-02-01 23:56 ` Ron Garret
2010-02-02 0:15 ` Petr Baudis
2010-02-02 0:45 ` Ron Garret
2010-02-02 0:53 ` Junio C Hamano
2010-02-02 1:12 ` Ron Garret
2010-02-02 19:19 ` J. Bruce Fields
2010-02-02 22:04 ` Ron Garret
2010-02-03 18:27 ` J. Bruce Fields
2010-02-02 4:05 ` Nicolas Pitre
2010-02-02 5:23 ` Ron Garret
2010-02-02 5:43 ` Nicolas Pitre
2010-02-02 21:07 ` tytso
2010-02-02 0:26 ` Junio C Hamano
2010-02-02 0:21 ` Junio C Hamano
2010-02-01 18:12 ` Nicolas Pitre
2010-02-01 18:27 ` Jay Soffian
2010-02-01 22:34 ` Steve Diver
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=ca433831001291959m76ed6adap32a17c10e465af1f@mail.gmail.com \
--to=lodatom@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.helwig@gmail.com \
--cc=nico@fluxnic.net \
--cc=ron1@flownet.com \
--cc=srabbelier@gmail.com \
/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 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 NNTP newsgroup(s).