Creating a list is not so difficult:
git diff --no-renames --name-only --diff-filter=D
To make it suitable for git checkout
, use -z
and xargs -0
:
git diff --no-renames --name-only --diff-filter=D -z | xargs -0 git checkout --
Note that using git checkout -f -- .
very different from the above as git checkout -f -- .
will overwrite files that have been modified but not yet added to the index, while the above will only retrieve files from the index that are still in the index but no longer in the working tree.
(If you do not have such modified files, git checkout -f -- .
Will work, but then git checkout -- .
Will be.)
torek source share