From: Junio C Hamano Date: Fri, 02 Feb 2007 01:11:09 GMT Subject: Re: [PATCH] detached HEAD -- finishing touches Message-ID: <7v64alnz2q.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20070201215242.GA1775@thunk.org> Theodore Tso writes: > On Thu, Feb 01, 2007 at 01:08:41AM -0800, Junio C Hamano wrote: >> [git.git]$ git checkout master >> You are not on any branch and switching to branch 'master' >> may lose your changes. At this point, you can do one of two things: >> (1) Decide it is Ok and say 'git checkout -f master'; >> (2) Start a new branch from the current commit, by saying >> 'git checkout -b '. >> Leaving your HEAD detached; not switching to branch 'master'. > > How hard would it be to simply simply set a flag once git has entered > a detached HEAD state, and clear the flag if any git operation has > modified the repository at all. If the flag is still set, then > obviously the repository hasn't changed and so there are no changes > that could be lost. Didn't I already point out that you can have a precious information while on the detached HEAD without making any commit, and that is the reason why we do not use the reachability crud from refs when deciding to issue the message?