Re: [PATCH 6/8] checkout: add --cached option
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 20, 2019, 03:52 UTC
- Message-ID
- <CACsJy8BbBx4jrmUKsDOEGcQay5FuGfc0DzCUjkYKLaq21yimVQ@mail.gmail.com>
- In-Reply-To
- <CABPp-BERuEtdjHhqaao+2=rsLXiPdkG4SbeULQ6=59hgWS5BLg@mail.gmail.com>
On Wed, Feb 20, 2019 at 5:05 AM Elijah Newren <newren@gmail.com> wrote:
Show 25 quoted lines
> > On Tue, Feb 19, 2019 at 11:10 AM Junio C Hamano <gitster@pobox.com> wrote: > > > > Junio C Hamano <gitster@pobox.com> writes: > > > > > I am getting the impression that to save typing, you would want to > > > make "--index --worktree" the default (i.e. among the above, only > > > --no-index and --no-worktree need to be spelled explicitly), but > > > there is one glitch. Updating from the index must be spelled > > > explicitly with "--no-index --worktree". > > > > And after getting reminded by Elijah, the default pair is > > <--no-index, --worktree>. > > Why would you want --no-index or --no-worktree as flags? That seems > to presume a default of modifying both the index and the working tree, > as these names imply undoing pieces of such a default. > > I'd rather have a flag like --worktree which alone only modifies the > working tree and is presumed to be the default (but useful to be > explicit or as mentioned later), have a flag for applying the changes > to the index instead (--index?), and treat applying to both the > working tree and the index as unusual and require either both flags > (--worktree --index ?) or some special flag that likely has a longer > name (--worktree-and-index?).
I'd prefer separate options. I even gave --worktree and --index shortcuts so we could write "git restore -IW" if "git restore --index --worktree" is used often (and I think it could be an alternative for "git reset --hard HEAD" if --force is also specified)
> I _think_ Duy does the latter reading over his manpage that he linked > to, but maybe I'm just reading my own biases into it.
Nah you read it right. The "examples" section also shows it.
-- Duy