Re: Instructions concerning detached head lead to lost local changes
- From
Nicolas Pitre <nico@cam.org>
- Date
- Feb 2, 2007, 02:49 UTC
- Message-ID
- <Pine.LNX.4.64.0702012135550.3021@xanadu.home>
- In-Reply-To
- <7v1wl9mj48.fsf@assigned-by-dhcp.cox.net>
On Thu, 1 Feb 2007, Junio C Hamano wrote:
Show 6 quoted lines
> Alternatively we could add yet another suggestion that let's you > discard the detached HEAD but still keep your local changes. > Either --drop by Linus renamed to some sensible name, or "the > obscure but useful trick". > > I dunno.
I have a feeling that proper reflog for HEAD would make the issue so much simpler.
But in the mean time I tend to agree with Ted about the fact that simply losing the detached position is not _that_ important. If you go to HEAD^ and want to come back to master I think it should just work (with a display of what the last position was as Carl mentioned).
It might be some work to get to a given position with a detached head and this very position might be valuable information, but if you then do "checkout HEAD^" you will still be detached but your previous position is lost just like it would be if you moved to master. Yet you're not prevented from going to HEAD^ but you are prevented from going to master.
Same issue if you perform a commit on top of a detached head. Nothing prevents you from doing "checkout HEAD^" which will leave your head detached but it will also silently drop your last commit dangling.
In short I think there is no magic solution other than proper reflog for HEAD.
Nicolas