From: Thomas Gummerer Date: Tue, 8 Jan 2019 21:52:24 +0000 (+0000) Subject: checkout: introduce --{,no-}overlay option X-Git-Tag: v2.22.0-rc0~181^2~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/091e04bc8cbb0c89c8112c4784f02a44decc257e?ds=inline;hp=091e04bc8cbb0c89c8112c4784f02a44decc257e checkout: introduce --{,no-}overlay option Currently 'git checkout' is defined as an overlay operation, which means that if in 'git checkout -- []' we have an entry in the index that matches , but that doesn't exist in , that entry will not be removed from the index or the working tree. Introduce a new --{,no-}overlay option, which allows using 'git checkout' in non-overlay mode, thus removing files from the working tree if they do not exist in but match . Note that 'git checkout -p -- []' already works this way, so no changes are needed for the patch mode. We disallow 'git checkout --overlay -p' to avoid confusing users who would expect to be able to force overlay mode in 'git checkout -p' this way. Untracked files are not affected by this change, so 'git checkout --no-overlay HEAD -- untracked' will not remove untracked from the working tree. This is so e.g. 'git checkout --no-overlay HEAD -- dir/' doesn't delete all untracked files in dir/, but rather just resets the state of files that are known to git. Suggested-by: Junio C Hamano Signed-off-by: Thomas Gummerer Signed-off-by: Junio C Hamano ---