Git rm

git rm

The git rm command removes, or deletes files from a working git tree and git index. See Git documentation for comprehensive details of the git -rm command.
The git rm command will remove a file from everywhere within the git tree as there is no option for removing a file from only the working directory.

### git rm –cached -r .
The wildcard “.” in place of the filename position in the command git rm –cached -r . removes all files from the staging area in a recursive fashion, hence the “-r” option. The –cached option in essence protects working tree files regardless of whether modifications have been applied.

### git rm -n
To determine which files would be affected by the git rm command, place the -n option in the command. Executing the command will indicate the files that would be removed had the -n option not been present.

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.