0 votes
1 view
in DevOps and Agile by (30k points)

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 generate a list of every deleted file across a repository's lifespan?

1 Answer

0 votes
by (51.2k points)

For listing all deleted files you could use:

git log --diff-filter=D --summary

And for info, you can see this answer: https://intellipaat.com/community/3107/find-and-restore-a-deleted-file-in-a-git-repository?show=3107#q3107

If  you don’t need more details on which commit they were removed you could simply use:

git log --diff-filter=D --summary | grep delete

Warning: This lists all files which you've deleted. If you've deleted a file, then created a new file with the same name, it will show up on this list, even though there's a file with that name.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !