From: Nicolas Pitre <nico@cam.org>
To: Theodore Tso <tytso@mit.edu>
Cc: Junio C Hamano <junkio@cox.net>, Carl Worth <cworth@cworth.org>,
git@vger.kernel.org
Subject: Re: Instructions concerning detached head lead to lost local changes
Date: Fri, 02 Feb 2007 02:14:07 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0702020206480.3021@xanadu.home> (raw)
In-Reply-To: <20070202065949.GI18880@thunk.org>
On Fri, 2 Feb 2007, Theodore Tso wrote:
> On Thu, Feb 01, 2007 at 09:49:27PM -0500, Nicolas Pitre wrote:
> > 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.
>
> Exactly. With Junio's reasoning, then why aren't we forcing -f in this sequence:
>
> git checkout HEAD^
> git checkout HEAD^^
> git checkout HEAD^^^
> git checkout -f master
>
> The first three are just as likely to "lose" information as the last.
> Personally, I don't think any of this is "losing" information, any
> more than I "lose" information in the following sequence of commands:
>
> cd /usr/src/linux/drivers/net
> cd /usr/src/linux/drivers/char
> cd /usr/src/linux/fs/ext3
> cd /home/tytso
>
> The current working directory is just like the detached HEAD. If I'm
> moving it around, there is no loss of data. cd != rm.
It's just that moving around amongst thousands of commits to pin point a
particular commit might require some digging work. This is why there
might be some value in a particular position and why there is an attempt
at protecting that "work".
But since moving to another position while still remaining detached from
any branch has the same potential for losing the important position and
so without any kind of protection then it makes no sense to have such a
protection when moving back to a branch.
Nicolas
next prev parent reply other threads:[~2007-02-02 7:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-01 22:51 Instructions concerning detached head lead to lost local changes Carl Worth
2007-02-01 23:49 ` Linus Torvalds
2007-02-02 1:41 ` Junio C Hamano
2007-02-02 2:00 ` Carl Worth
2007-02-02 2:06 ` Carl Worth
2007-02-02 2:49 ` Nicolas Pitre
2007-02-02 6:59 ` Theodore Tso
2007-02-02 7:14 ` Nicolas Pitre [this message]
2007-02-02 7:44 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0702020206480.3021@xanadu.home \
--to=nico@cam.org \
--cc=cworth@cworth.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).