Re: [PATCH] Detached HEAD (experimental)
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jan 11, 2007, 00:34 UTC
- Message-ID
- <7vslei764u.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20070110140432.GA20868@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> On Tue, Jan 09, 2007 at 03:46:32PM -0800, Linus Torvalds wrote: > >> I would suggest a solution: >> >> - git checkout will refuse to switch AWAY from a detached head unless the >> SHA1 of the detached head exactly matches some other branch. > > What about > > git checkout HEAD~20 > > I agree that checking out tags will be more common, but it feels like we > are discouraging this usage by presenting spurious warning messages.
Once the user knows what HEAD~20 means, I think it is safe to assume that the user knows what the branches are.
"git checkout master" will barf and suggests the user possible common exits; "checkout -f" if there is nothing of value, "checkout -b <branch>" or if they want to build on the current state.
And once the user who knows what the branches are sees such, and especially with the help from $PS1 hack of bash-completion in contrib/ section, the user will learn to do "checkout -f" after wandering around for sightseeing on a detached HEAD, and at that point the annoying error message will not be even seen.