Re: [PATCH 6/8] checkout: add --cached option
- From
Elijah Newren <newren@gmail.com>
- Date
- Dec 11, 2018, 06:12 UTC
- Message-ID
- <CABPp-BGQwtok1T3WmY3ndBG6RjbESSOgmbZxkWiN-avqfUjDVg@mail.gmail.com>
- In-Reply-To
- <xmqqva40lps2.fsf@gitster-ct.c.googlers.com>
On Mon, Dec 10, 2018 at 7:13 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 32 quoted lines
> > Duy Nguyen <pclouds@gmail.com> writes: > > > Elijah wanted another mode (and I agree) that modifies worktree but > > leaves the index alone. This is most useful (or least confusing) when > > used with <tree-ish> and would be default in restore-files. I'm not > > saying you have to implement it, but how do the new command line > > options are designed to make sense? > > I'd model it after "git apply", i.e. > > git restore-files [--tree=<treeish>] <pathspec> > > would work only on the working tree files, > > git restore-files --tree=<treeish> --cached <pathspec> > > would match the entries in the index that match pathspec to the > given treeish without touching the working tree, and > > git restore-files --tree=<treeish> --index <pathspec> > > would be both. > > I have never been happy with the phraso, the (arbitrary) distinction > between --cached/--index we use, so in the very longer term (like, > introducing synonym at 3.0 boundary and deprecating older ones at > 4.0 boundary), it may not be a bad idea to rename "--index" to > "--index-and-working-tree" and "--cached" to "--index-only". > > But until that happens, it would be better to use these two > consistently.
I agree that consistency is important, but trying to distinguish between "--cached" and "--index" is _extremely_ painful. I still can't keep the distinction straight and have to look it up every time I want to use either. I don't know how to possibly teach users the meaning. Could we introduce synonyms earlier at least, and make the synonyms more prominent than the "--cached" and "--index" terms in the documentation?