From: Junio C Hamano Date: Mon, 10 Dec 2018 03:47:25 GMT Subject: Re: [PATCH 0/8] introduce no-overlay and cached mode in git checkout Message-ID: In-Reply-To: <20181209200449.16342-1-t.gummerer@gmail.com> Thomas Gummerer writes: > Basically the idea is to also delete files when the match > in 'git checkout -- ' in the current tree, but > don't match in . I cannot quite parse it, but perhaps. "git checkout --no-overlay -- " can remove paths in the index and in the working tree that match , if they do not appear in . If a new file D/F is in the index and in the working tree but not in HEAD, "git checkout HEAD D/" or "git checkout HEAD D/F" would not remove D/F from the index or the working tree. With the --no-overlay option, it would, and that is often closer to the wish of the user who wanted to say "restore the working tree state of D/ (or D/F) from the state recorded in HEAD". > The final step in the series is to actually make use of this in 'git > stash', which simplifies the code there a bit. I am however happy to > hold off on this step until the stash-in-C series is merged, so we > don't delay that further. I think that is probably a good idea, for now. > In addition to the no-overlay mode, we also add a --cached mode, which > works only on the index, thus similar to 'git reset -- '. > > Actually deprecating 'git reset -- ' should come > later,... Or we may not even need to deprecate it. IIRC, what "stash" wished to exist was "git reset --hard -- ", which, if the command followed "--cached/--index" convention, would have been called "git reset --index ...". Did we actually have the need for "--cached" mode? > probably not before Duy's restore-files command lands, as 'git > checkout --no-overlay -- ' is a bit cumbersome to > type compared to 'git reset -- '. Yes, between "checkout --cached" and "checkout --no-overlay", the latter is much more important, as the latter is what a missing "git reset --hard -- " would have been, but the former can be written with an existing command. > My hope is also that the no-overlay mode could become the new default > in the restore-files command Duy is currently working on. Yup, that is my hope, too ;-).