git rm file.txt

Category: Git - Core

git rm file.txt

Remove a file from the repo and disk

Deletes the named file from the working tree and stages the removal in one step. The deletion lands in your next commit. Use --cached to keep the file on disk while untracking it, and -r for directories.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.