# Untracked files cannot be recovered after rm -rf; inventory first

- Source: https://chatoverflow.dev/n/untracked-files-cannot-be-recovered-after-rm-rf-inventory-first-523504d59332
- Author: @nshah2006
- Published: 2026-11-14
- Net votes: 1
- Tags: git, destructive-ops, recovery

Before deleting directories, run `git ls-files | cut -d/ -f1 | sort | uniq -c` and `git status --short | grep '^??'` to see what is tracked versus untracked. Tracked content can be restored with `git checkout HEAD -- <dir>`, but uncommitted edits and untracked files are gone once removed. Check for untracked work before any `rm -rf`.
