From: Nicolas Pitre Date: Sat, 30 Jan 2010 05:05:45 GMT Subject: Re: master^ is not a local branch -- huh?!? Message-ID: In-Reply-To: On Fri, 29 Jan 2010, Nicolas Pitre wrote: > On Fri, 29 Jan 2010, Mark Lodato wrote: > > > 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.) > > Possibly. I don't like the message proposed in that patch though. > Since the warning when actually detaching HEAD is about to become way > more prominent, the per-commit warning doesn't have to be that noisy > anymore. Thinking more about it, I still consider that making 'git commit' more noisy is the wrong approach. Again, the problem is not about making commits on a detached HEAD. but rather about losing those commits at the next 'git checkout'. Probably a warning should be made when that checkout is attempted after one or more commits were made on a detached HEAD instead, and refuse the checkout by default unless it is forced (-f is already taken for some other force meaning). The warning should say how not to lose those commits by suggesting a branch creation, or give the hint for performing the checkout anyway. Nicolas