I know Git stores information of when files get deleted and I am able to check individual commits to see which files have been removed, but is there a command that would gen
Since Windows doesn't have a grep
command, this worked for me in PowerShell:
git log --find-renames --diff-filter=D --summary | Select-String -Pattern "delete mode" | sort -u > deletions.txt
Citing this Stack Overflow answer.
It is a pretty neat way to get type-of-change (A:Added, M:Modified, D:Deleted) for each file that got changed.
git diff --name-status
Show all deleted files in some_branch
git diff origin/master...origin/some_branch --name-status | grep ^D
or
git diff origin/master...origin/some_branch --name-status --diff-filter=D
If you're only interested in seeing the currently deleted files, you can use this:
git ls-files --deleted
if you then want to remove them (in case you deleted them not using "git rm") pipe that result to xargs git rm
git ls-files --deleted | xargs git rm
git log --diff-filter=D --summary
See Find and restore a deleted file in a Git repository
If you don't want all the information about which commit they were removed in, you can just add a grep delete
in there.
git log --diff-filter=D --summary | grep delete
This does what you want, I think:
git log --all --pretty=format: --name-only --diff-filter=D | sort -u
... which I've just taken more-or-less directly from this other answer.