git-rm(1)
=========
NAME
----
git-rm - Remove files from the working tree and from the index
SYNOPSIS
--------
[synopsis]
git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]
[--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]
[--] [<pathspec>...]
DESCRIPTION
-----------
Remove files matching pathspec from the index, or from the working tree
and the index. `git rm` will not remove a file from just your working
directory. (There is no option to remove a file only from the working
tree and yet keep it in the index; use `/bin/rm` if you want to do
that.) The files being removed have to be identical to the tip of the
branch, and no updates to their contents can be staged in the index,
though that default behavior can be overridden with the `-f` option.
When `--cached` is given, the staged content has to
match either the tip of the branch or the file on disk,
allowing the file to be removed from just the index. When
sparse-checkouts are in use (see linkgit:git-sparse-checkout[1]),
`git rm` will only remove paths within the sparse-checkout patterns.
OPTIONS
-------
`<pathspec>...`::
Files to remove. A leading directory name (e.g. `dir` to remove
`dir/file1` and `dir/file2`) can be given to remove all files in
the directory, and recursively all sub-directories, but this
requires the `-r` option to be explicitly given.
+
The command removes only the paths that are known to Git.
+
File globbing matches across directory boundaries. Thus, given two
directories `d` and `d2`, there is a difference between using
`git rm 'd*'` and `git rm 'd/*'`, as the former will also remove all
of directory `d2`.
+
For more details, see the _<pathspec>_ entry in linkgit:gitglossary[7].
`-f`::
`--force`::
Override the up-to-date check.
`-n`::
`--dry-run`::
Don't actually remove any file(s). Instead, just show
if they exist in the index and would otherwise be removed
by the command.
`-r`::
Allow recursive removal when a leading directory name is
given.
`--`::
This option can be used to separate command-line options from
the list of files, (useful when filenames might be mistaken
for command-line options).
`--cached`::
Use this option to unstage and remove paths only from the index.
Working tree files, whether modified or not, will be
left alone.
`--ignore-unmatch`::
Exit with a zero status even if no files matched.
`--sparse`::
Allow updating index entries outside of the sparse-checkout cone.
Normally, `git rm` refuses to update index entries whose paths do
not fit within the sparse-checkout cone. See
linkgit:git-sparse-checkout[1] for more.
`-q`::
`--quiet`::
`git rm` normally outputs one line (in the form of an `rm` command)
for each file removed. This option suppresses that output.
`--pathspec-from-file=<file>`::
Pathspec is passed in _<file>_ instead of args. If
_<file>_ is exactly `-` then standard input is used. Pathspec
elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be
quoted as explained for the configuration variable `core.quotePath`
(see linkgit:git-config[1]). See also `--pathspec-file-nul` and
global `--literal-pathspecs`.
`--pathspec-file-nul`::
Only meaningful with `--pathspec-from-file`. Pathspec elements are
separated with _NUL_ character and all other characters are taken
literally (including newlines and quotes).
REMOVING FILES THAT HAVE DISAPPEARED FROM THE FILESYSTEM
--------------------------------------------------------
There is no option for `git rm` to remove from the index only
the paths that have disappeared from the filesystem. However,
depending on the use case,