From: Junio C Hamano Date: Tue, 09 Jan 2007 01:05:26 GMT Subject: Re: [PATCH] Detached HEAD (experimental) Message-ID: <7v7ivxt3ft.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <87fyalyqqz.wl%cworth@cworth.org> Carl Worth writes: > On Mon, 08 Jan 2007 16:19:28 -0800, Junio C Hamano wrote: >> The first checkout, because there is no branch v1.4.0, makes the >> HEAD detached. You are no longer on any branch at that point, >> and "git checkout v1.2.0" that follows do not trigger the check >> which is about "coming back from the detached HEAD state". > > So what's the final check? Is it "can come from detached HEAD to a > branch only if the detached HEAD is reachable from the target branch"? > > If so, that's still a trap for people who are just exploring with "git > checkout" and never make any commits while detached. An obvious alternative is not to allow building on top of a HEAD that is detached at all, which I suggested initially. A non-alternative is to silently lose commits, which you seem to be suggesting, but I would rather play it safe. The wording used for current warning that says "use checkout -f" is horrible, and it needs to be reworded much better, but other than that, I think playing safer is much better than making a worse trap of silently losing the commits they may make before they come to understand how "a branch" works.