Git

git rm

CautionRemove from tracking

git rm [--cached] <file>

Deletes and stages; --cached untracks while keeping the file — for accidentally committed artifacts.

Examples

  • git rm --cached .envUntrack but keep the file

Syntax

git rm [--cached] [-r] <path>

Before you run it

Without --cached the file itself is deleted.

Related commands

The same reference, with no signal at all

Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.

Get it free on the App Store