git rm
Remove files from repository index and local filesystem. More information: https://git-scm.com/docs/git-rm.
-
Remove file from repository index and filesystem:
git rm {{path/to/file}}
-
Remove directory:
git rm -r {{path/to/directory}}
-
Remove file from repository index but keep it untouched locally:
git rm --cached {{path/to/file}}
License and Disclaimer
The content on this page is copyright © 2014—present the tldr-pages team and contributors.This page is used with permission under Creative Commons Attribution 4.0 International License.
While we do attempt to make sure content is accurate, there isn't a warranty of any kind.