git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Sverre Rabbelier <srabbelier@gmail.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Git List <git@vger.kernel.org>, Jakub Narebski <jnareb@gmail.com>
Subject: Re: non-empty index with git commit -a
Date: Wed, 16 Feb 2011 14:36:43 -0500	[thread overview]
Message-ID: <20110216193643.GB22045@sigill.intra.peff.net> (raw)
In-Reply-To: <7vpqqrke30.fsf@alter.siamese.dyndns.org>

On Wed, Feb 16, 2011 at 10:51:31AM -0800, Junio C Hamano wrote:

> > OK, so how precious is it? :)
> 
> The world is not that black-and-white, but is full of different shades of
> gray.
> 
> If you made mistakes with a second "git add", you can "reset --mixed"
> everything away and restart from scratch.  The same thing can be said for
> a mistaken "git commit -a" that can be "reset HEAD^" (or --amend).  So
> there is not much difference at the technical level.

Sure. The problem there is that "scratch" may involve losing some work
you did picking apart changes.

> I don't think this is primarily about "protecting the index".  It is more
> about making the user feel better.  Compared to a mistaken second "add", a
> mistaken "commit -a" feels like a lot heavier point-of-no-return.

I guess. I have very occasionally run into the second-add problem and
wanted to be able to return to an earlier index state, but I admit it
doesn't come up that much. I just see them as the same problem.

I think I am also a little turned off by the config option solution
because it seems very un-git to me. Our usual approach is to give the
user a lot of flexibility, let them shoot their own foot off, and then
let them know that their intact foot is waiting in the reflog, ready to
be sewn back on.

Yes, we try to limit uselessly destructive actions before they happen.
But this is not one of those cases. The exact command set that is being
listed as dangerous is also part of a very reasonable workflow. It just
depends on what the user's intention was.

But as I said, I am not against a config option if it is such a common
problem. I certainly would not turn it on. And I don't think it should
be on by default.

-Peff

  reply	other threads:[~2011-02-16 19:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15 22:43 non-empty index with git commit -a Sverre Rabbelier
2011-02-16  2:36 ` Jeff King
2011-02-16  3:20   ` Jonathan Nieder
2011-02-16  3:27     ` Jeff King
2011-02-16  8:18     ` Sverre Rabbelier
2011-02-16  8:29       ` Nguyen Thai Ngoc Duy
2011-02-16  8:44         ` Jonathan Nieder
2011-02-16  8:51       ` Jeff King
2011-02-16  9:52         ` Sverre Rabbelier
2011-02-16  9:54           ` Jeff King
2011-02-16  9:58             ` Sverre Rabbelier
2011-02-16 10:06               ` Jeff King
2011-02-16 14:41                 ` Michael J Gruber
2011-02-16 19:29                   ` Jeff King
2011-02-16 18:51                 ` Junio C Hamano
2011-02-16 19:36                   ` Jeff King [this message]
2011-02-16 19:55                     ` Junio C Hamano
2011-02-16 19:59                       ` Jeff King
2011-02-16 21:03                         ` Jakub Narebski
2011-02-16 21:46                           ` Junio C Hamano
2011-02-16 22:34                             ` Jeff King
2011-02-16 10:28             ` Matthieu Moy
2011-02-16 19:48               ` Jeff King
2011-02-16 18:47           ` Junio C Hamano
2011-02-16  9:05     ` Matthieu Moy

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110216193643.GB22045@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    --cc=jrnieder@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).