From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Lodato Subject: Re: master^ is not a local branch -- huh?!? Date: Sat, 30 Jan 2010 00:53:47 -0500 Message-ID: References: <7vy6jgcutb.fsf@alter.siamese.dyndns.org> <7viqakcu56.fsf@alter.siamese.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Junio C Hamano , Sverre Rabbelier , Git List , Ron1 , Jacob Helwig To: Nicolas Pitre X-From: git-owner@vger.kernel.org Sat Jan 30 06:55:32 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nb6It-0007zh-VJ for gcvg-git-2@lo.gmane.org; Sat, 30 Jan 2010 06:55:32 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751117Ab0A3FyJ convert rfc822-to-quoted-printable (ORCPT ); Sat, 30 Jan 2010 00:54:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751095Ab0A3FyJ (ORCPT ); Sat, 30 Jan 2010 00:54:09 -0500 Received: from mail-pz0-f172.google.com ([209.85.222.172]:49523 "EHLO mail-pz0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050Ab0A3FyI convert rfc822-to-8bit (ORCPT ); Sat, 30 Jan 2010 00:54:08 -0500 Received: by pzk2 with SMTP id 2so2305723pzk.21 for ; Fri, 29 Jan 2010 21:54:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=102szciCoHrf4dINbv8xKKbmmbtbCg5vA8j7X6qBhQM=; b=aWxYEAhSirC87mnhJmLXqn+IShdAvEb2qxFDW45cClY2kyKWgi0Dy94XtRukvUk7Ws uHBeTDfiB5vTaxIGc5dSvRB0Sb+ebERsQkBR/XTA1n4fxzMg0WgX91ZKFS5SLpZaQ9mi cTnDHzhnd3iEgJMSXb6DF5nEkwNA8Bil4JQRM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=q/p8ZuYBkxUL0RsfbayMkVAl6GgS1zt0gblLZa1w+Sn0SqJpq2UCFwprI+xpxfyboa X67Cdx6CEKznUmm69orHbpfPzLhsn9wHcbQ6r1FtSIY/eD9eHvekk3IhROBcXlVhFp4I eWs/aPLEUJMdvkB0NmRTOp2sMKxvjzXbdu43w= Received: by 10.114.188.38 with SMTP id l38mr1236366waf.63.1264830847086; Fri, 29 Jan 2010 21:54:07 -0800 (PST) In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Fri, Jan 29, 2010 at 11:39 PM, Nicolas Pitre wrot= e: > First, I'm afraid that "Checking out commit 'foobar'" might be confus= ing > as this may happen through either a remote branch, a tag, or any rand= om > commit. =C2=A0It seems to me that "Checking out 'v2.5'" is less confu= sing > than "Checking out commit 'v2.5'". =C2=A0But that's a minor detail an= d > probably a personal preference. I'm fine with "Checking out 'v2.5'". > I consider that starting the explanation paragraph with " any commits > you make will be lost" is even more unfriendly, and misleading. =C2=A0= That is > sure to scare people needlessly. See wording below. > I think your wording is just too far on the negative side, and makes = Git > look like an even more difficult tool than it actually is. And you h= elp > no one by stating things that are not exactly true even if the truth > implies that you need to know what you're doing. What is not true? Sure, they're not really "lost", but there's no concise yet fully correct way to say the full truth. Would you prefer "discarded"? > The _whole_ and only > point of a detached HEAD is actually to be able to make commits even > without having to create a new branch first. Wrong. I have never (purposefully) made a commit on a detached HEAD, yet I use a detached HEAD all the time. Why? Because I checkout a particular commit to look at code at a given location. For example, I recently ran "git checkout v1.6.6.1". I did not intend to make any commits on this; I just wanted to look at and compile code at a particular version. I think most users do the same thing. The reason for the warning is that folks make a mistake of trying to commit without first switching back to (or creating) a branch. Anyway, how about the following message, which is more in line with Junio's last version? -- >8 -- not a patch -- >8 -- Checking out 'master^0'. This is not a local branch head, so you are in a 'detached HEAD' state. If you only plan to look at files, this is fine. However, any commits = you make will not update a branch, and may be discarded when you check out another branch or commit. If you want to create a new branch to retain commits you create, you ma= y do so (now or later) by using -b with the checkout command again. Examp= le: git checkout -b HEAD is now at a9d7c95... Merge branch 'maint' -- 8< -- not a patch -- 8< --