git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: non-empty index with git commit -a

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2011, 18:51 UTC
Message-ID
<7vpqqrke30.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110216100622.GA12971@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> On Wed, Feb 16, 2011 at 09:58:52AM +0000, Sverre Rabbelier wrote:
>
>> On Wed, Feb 16, 2011 at 09:54, Jeff King <peff@peff.net> wrote:
>> > So? Your question was whether index state is precious. If it's precious,
>> > shouldn't we be keeping a history of it?
>> 
>> I don't think it's quite _that_ precious, but the only operation that
>> I regularly use that can blow away my carefully constructed index as
>> side effect of doing something else is `git commit -a`.
>
> 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.

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.

Previous: Jeff KingNext: Jeff King
Message 15 of 25 in “non-empty index with git commit -a”
  1. Sverre RabbelierFeb 15, 2011
  2. Jeff KingFeb 16, 2011
  3. Jonathan NiederFeb 16, 2011
  4. Jeff KingFeb 16, 2011
  5. Sverre RabbelierFeb 16, 2011
  6. Nguyen Thai Ngoc DuyFeb 16, 2011
  7. Jonathan NiederFeb 16, 2011
  8. Jeff KingFeb 16, 2011
  9. Sverre RabbelierFeb 16, 2011
  10. Jeff KingFeb 16, 2011
  11. Sverre RabbelierFeb 16, 2011
  12. Jeff KingFeb 16, 2011
  13. Michael J GruberFeb 16, 2011
  14. Jeff KingFeb 16, 2011
  15. Junio C HamanoFeb 16, 2011
  16. Jeff KingFeb 16, 2011
  17. Junio C HamanoFeb 16, 2011
  18. Jeff KingFeb 16, 2011
  19. Jakub NarebskiFeb 16, 2011
  20. Junio C HamanoFeb 16, 2011
  21. Jeff KingFeb 16, 2011
  22. Matthieu MoyFeb 16, 2011
  23. Jeff KingFeb 16, 2011
  24. Junio C HamanoFeb 16, 2011
  25. Matthieu MoyFeb 16, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.