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.