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

Re: [PATCH v2 0/1] Make 'git commit' not accidentally lose staged content

From
Jacob Keller <jacob.keller@gmail.com>
Date
Sep 18, 2018, 19:41 UTC
Message-ID
<CA+P7+xq1zMM=S+HBTAfTJcPVo35PtUCq+staQ8SnSXxP0RShXA@mail.gmail.com>
In-Reply-To
<xmqq7ejk6i46.fsf@gitster-ct.c.googlers.com>
On Mon, Sep 17, 2018 at 12:26 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> FWIW, I didn't mean to say that we should give users a way to
> recover.  Your "commit -a" or "commit $path" protection just
> prevents the situation from happening, and I think it is sufficient.
>
> The sole point I wanted to raise by bringing up the above was that
> we should have the same degree of protection against "add $path" or
> "add -u".
>
> Of course, "index log" is interesting and it may even turn out to be
> useful (I was skeptical about "reference log" the same way, but it
> turned out to be useful without burdening the system too heavily),
> and it may even remove the need for the "do not accidentally lose
> information by adding more to the index" protection.  But until that
> happens, if we are to have such a protection, we would wnat to give
> the same degree of protection to "commit" and "add".

I think having both is good. There are a lot of ways to accidentally throw away work, and it's pretty frustrating to have it happen. But the reflog is also somewhat complicated, and I've definitely seen a lot of developers who've never heard of it, and struggle with the concept.

I personally think having the nice "it looks like you're about to throw away all your changes, are you sure" style of protection using something like --clobber-index is useful as a mode, even if we have an index log of sorts. Having it be default helps new people, even if it does get in the way of someone who knows what they're doing. Having it be configurable, to me, sort of defeats the point, since it means having to tell people to turn this on.

I personally don't mind having to type an extended option to clobber when I know it's what I want, but I can see that being painful.

However, if we had a reflog for the index, this becomes less of a problem since recovery is much easier.

Thanks, Jake

Previous: Junio C HamanoNext: Eckhard Maaß
Message 26 of 28 in “commit: new option to abort -a something is already staged”
  1. commit: new option to abort -a something is already stagedNguyễn Thái Ngọc Duy, Aug 20, 2018
  2. Junio C HamanoAug 20, 2018
  3. Eric SunshineAug 20, 2018
  4. Jonathan NiederAug 20, 2018
  5. Duy NguyenAug 21, 2018
  6. Jonathan NiederAug 23, 2018
  7. Jonathan NiederAug 23, 2018
  8. Duy NguyenAug 23, 2018
  9. Junio C HamanoAug 23, 2018
  10. Jacob KellerAug 24, 2018
  11. Duy NguyenAug 24, 2018
  12. Jacob KellerAug 24, 2018
  13. Jacob KellerAug 24, 2018
  14. 0/1 Make 'git commit' not accidentally lose staged contentNguyễn Thái Ngọc Duy, Sep 16, 2018
  15. 1/1 commit: do not clobber the indexNguyễn Thái Ngọc Duy, Sep 16, 2018
  16. Junio C HamanoSep 17, 2018
  17. Duy NguyenSep 17, 2018
  18. Jeff KingSep 17, 2018
  19. Duy NguyenSep 17, 2018
  20. Jeff KingSep 18, 2018
  21. Jacob KellerSep 18, 2018
  22. Jeff KingSep 18, 2018
  23. Duy NguyenSep 19, 2018
  24. Jeff KingSep 19, 2018
  25. Junio C HamanoSep 17, 2018
  26. Jacob KellerSep 18, 2018
  27. Eckhard MaaßSep 18, 2018
  28. Jacob KellerSep 18, 2018

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.