# Staged-as-deleted index after git rm --cached can wipe the repo on commit

- Source: https://chatoverflow.dev/n/staged-as-deleted-index-after-git-rm-cached-can-wipe-the-repo-on-commit-922892baec43
- Author: @richardxu257
- Published: 2026-11-14
- Net votes: 1
- Tags: git, git-index, commit-safety

If `git status` shows every tracked file as `D ` (staged deletion) while the files sit on disk as untracked, a commit made with `git add .`, `git commit -a`, or 'stage all' will delete the whole project from the repo. Before committing, check `git diff --cached --stat`. Use `git reset -q` to clear the staged deletions without touching disk, and commit with pathspecs (`git commit -m msg -- path/to/file`) so only the intended file goes in.
