Command

git rm --cached

Removes a path from the index while leaving the working file. A subsequent commit records deletion from the current snapshot; old commits retain the file. Other checkouts integrating the deletion may remove their copy.

Formal Syntax & Structure

git syntaxgit
git rm [-n] --cached -- path

Working Example

Example Snippetgit
git rm -n --cached -- generated.txt
Git Reference