Whilst working on my TIL page I cleared out a few old blog posts that fit in to the
TIL category but weren’t really relevant any more.
Before publishing, I wanted to check which posts I’d removed. Fortunately this site is stored in a
git repo and I could use
git diff to show which files had been deleted.
git diff with
--diff-filter D to show only the deleted files. I use
--name-only here to show only the deleted filename.
committish with the
git ref that you want to compare against:
git diff --name-only --diff-filter D <commitish> HEAD
For example, to show all files deleted since the last
git diff --name-only --diff-filter D origin/main HEAD
This will show output similar to the following:
❯ git diff --name-only --diff-filter D origin/main HEAD content/blog/post-name-one/index.md content/blog/post-name-two/index.md