From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Sverre Rabbelier" <srabbelier@gmail.com>,
"Ævar Arnfjörð" <avarab@gmail.com>,
git@vger.kernel.org
Subject: Re: What's cooking in git.git (Feb 2011, #06; Sun, 27)
Date: Wed, 2 Mar 2011 16:27:24 -0500 [thread overview]
Message-ID: <20110302212724.GE20400@sigill.intra.peff.net> (raw)
In-Reply-To: <7vlj0yff6m.fsf@alter.siamese.dyndns.org>
On Tue, Mar 01, 2011 at 06:07:29PM -0800, Junio C Hamano wrote:
> > On Mon, Feb 28, 2011 at 08:52:08AM -0800, Junio C Hamano wrote:
> >
> >> I am not convinced that this patch nailed that balance at exactly the
> >> right place, even though I think we are getting closer than before. In
> >> this sequence:
> >>
> >> $ git checkout somewhere^0
> >> $ git commit
> >> $ git reset --hard somewhere_else
> >> $ git commit
> >> $ git checkout master
> >> ...
> > I really wouldn't expect it to help here. The problem isn't that you're
> > on a detached HEAD. It's that you're using "git reset" at all.
>
> As you would realize later in your message, the "reset --hard" can instead
> be "checkout v1.7.3". And the bothersome thing is that there is no safety
> against that. We don't bother users while they are jumping around on
> detached HEAD, and it is not new; we don't say where the previous detached
> HEAD was.
No, "checkout v1.7.3" should engage the safety valve. And in your patch,
it does. So replacing your reset --hard with checkout _is_ safe. And I
think that behavior is reasonable. Reset's purpose is about shifting
HEAD to drop history, whether you are on a detached HEAD or not. Having
it warn would be annoying and pointless.
Checkout, on the other hand, is about moving your working tree to a
different place in history, and we _should_ warn about dropping history.
So it is really just a matter of educating users to use the appropriate
tool for sight-seeing (and I don't think there is much education to be
done; checkout seems like the obvious choice given it is how you got to
the first commit).
-Peff
next prev parent reply other threads:[~2011-03-02 21:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 6:48 What's cooking in git.git (Feb 2011, #06; Sun, 27) Junio C Hamano
2011-02-28 13:22 ` Sverre Rabbelier
2011-02-28 16:52 ` Junio C Hamano
2011-03-01 20:54 ` Jeff King
2011-03-02 2:07 ` Junio C Hamano
2011-03-02 21:27 ` Jeff King [this message]
2011-03-02 5:24 ` Junio C Hamano
2011-03-02 7:17 ` Piotr Krukowiecki
2011-03-02 10:32 ` Jakub Narebski
2011-03-10 9:44 ` Ævar Arnfjörð Bjarmason
2011-03-10 16:37 ` Jakub Narebski
2011-03-02 21:28 ` Jeff King
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=20110302212724.GE20400@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=srabbelier@gmail.com \
/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).