Re: master^ is not a local branch -- huh?!?
- From
Mark Lodato <lodatom@gmail.com>
- Date
- Jan 30, 2010, 01:01 UTC
- Message-ID
- <ca433831001291701m50b8c2b7p16bcc6fd4f3f3d55@mail.gmail.com>
- In-Reply-To
- <7viqakcu56.fsf@alter.siamese.dyndns.org>
On Fri, Jan 29, 2010 at 7:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> How about this? > > -- >8 -- not a patch -- >8 -- > Note: 'master^0' isn't a local branch head; > > 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. > > 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> > > HEAD is now at a9d7c95... Merge branch 'maint' > -- 8< -- not a patch -- 8< --
First off, I would like to voice support for such a warning. This is so much more clear than the current message.
Still, I find it slightly confusing and unfriendly. How about the following?
-- >8 -- not a patch -- >8 -- 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>
HEAD is now at a9d7c95... Merge branch 'maint' - 8< -- not a patch -- 8< --
I think the above wording is fine for both commits (e.g. master^0) and remote branches (e.g. origin/pu). With other wording, we may wish to have two slightly different messages depending on what the user typed.
Also, I am not a big fan of "local branch head". How about "not the name of a local branch"? I'm not sure...