How to list commits that deleted files in git

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the git category.

Last Updated: 2021-05-15

Has their ever been a file that's mysteriously gone missing from a repo and you are wondering if someone removed it?

Git has your back:

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

This reports, from most recent to least, commits that deleted files - along with what files they deleted:

commit 1c2fc79e1f0dfa49602e594865410d425cc0b6b1
Author: Jack Kinsella <151206+jackkinsella@users.noreply.github.com>
Date:   Tue Nov 26 18:06:18 2019 +0100

    Update reverse auction in line with new requirements (not logged in)

 delete mode 100644 resources/views/component/form/check_languages.blade.php

commit d5b1d53d8e1285bef2b0062ac9713ed16f573944
Author: Someone Else <someone@gmail.com>
Date:   Tue Nov 26 18:27:23 2019 +0100

    removed files - maybe done by icloud

 delete mode 100644 data/mietendeckel_wohnlage.csv
 delete mode 100644 resources/images/login_background.jpg

Lesson

Use git log in combination with the diff-filter=D to find deleted files.