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

Re: [PATCH] update-index: add --swap to swap index and worktree content

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 17, 2011, 18:26 UTC
Message-ID
<7vr54jevxp.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAOeW2eFx-ETS+1a5b2bUXeT8JJ0WGudKGyF6mxuqyK2OM35qQA@mail.gmail.com>
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:
> Maybe the above shows that I'm missing something. Still, would it be
> possible to achieve the use case with something like the following?
>
> git stash --keep-index

While I sense a vague aversion to committing in general in this discussion, which I am not particularly fond of, the whole point of "stash" is to avoid the mental burden of going over the "hump" of committing something not ready and to replace it with a "save it as a temporary state" that technically has the same overhead of committing but has a lot less mental overhead. Perhaps "swapping the state of all and/or selected paths" fits better in "stash", not "update-index"?

I dunno, but in general, a new feature to cater to _common_ end user needs should fit in the Porcelain layer. We would be doing something wrong if we need to teach an obscure option of lower plumbing to end users.

I personally used to feel that "ls-files -u" during a conflicted merge to be the single sore-thumb that stuck out from this point of view, but these days "status -s" gives the same information in a more useful way to the end users, and I am reasonably happy with that. It may be that the end user operation (perhaps "stash --swap", but I am not married to that) that fits well in common workflows ends up using "update-index --swap" as an underlying implementation detail, but I'd prefer to see how the final end user experience using Porcelain would look like first.

Previous: Nguyen Thai Ngoc DuyNext: Jeff King
Message 14 of 16 in “update-index: add --swap to swap index and worktree content”
  1. update-index: add --swap to swap index and worktree contentNguyễn Thái Ngọc Duy, Aug 12, 2011
  2. Michael J GruberAug 16, 2011
  3. Nguyen Thai Ngoc DuyAug 16, 2011
  4. Junio C HamanoAug 16, 2011
  5. Jeff KingAug 16, 2011
  6. Junio C HamanoAug 16, 2011
  7. Jeff KingAug 16, 2011
  8. Junio C HamanoAug 16, 2011
  9. Jeff KingAug 16, 2011
  10. Nguyen Thai Ngoc DuyAug 17, 2011
  11. Jeff KingAug 17, 2011
  12. Martin von ZweigbergkAug 17, 2011
  13. Nguyen Thai Ngoc DuyAug 17, 2011
  14. Junio C HamanoAug 17, 2011
  15. Jeff KingAug 17, 2011
  16. Martin von ZweigbergkAug 18, 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.