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

Re: non-empty index with git commit -a

From
Jeff King <peff@peff.net>
Date
Feb 16, 2011, 19:48 UTC
Message-ID
<20110216194855.GC22045@sigill.intra.peff.net>
In-Reply-To
<vpqbp2cmfy6.fsf@bauges.imag.fr>
On Wed, Feb 16, 2011 at 11:28:17AM +0100, Matthieu Moy wrote:
Show 8 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > So? Your question was whether index state is precious. If it's precious,
> > shouldn't we be keeping a history of it?
> 
> If it's really precious, it probably means you should be commit
> --amend instead. You'd get the reflog, and essentially the same
> functionalities.

Yeah, that is good advice, and I do actually end up doing a lot of intermediate commits and then either amending or sorting them out at the end. And that helps with sorting out big changes.

But it does sort of feel like saying "we don't need a safety valve. You just need to back up your work before doing anything dangerous". I have to remember to do it. Which is fine if my workflow is add-amend-add-amend. But maybe I have some half-saved index state and I am about to try doing a merge checkout or stash apply.

Anyway, I'm not convinced it is all that precious (at least not enough to merit working on the reflog). Yes, there have been times I've wished I could go back to the index state of a minute ago, and had to re-sort changes. But it usually doesn't take all that much time (thanks to "git add -p"). My main objection is that I just don't see those cases as different from "git commit -a". Either it is worth protecting, or it isn't.

-Peff
Previous: Matthieu MoyNext: Junio C Hamano
Message 23 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.