Documentation / git-rm.txton commit Merge branch 'db/no-git-config' (5e97f46)
   1git-rm(1)
   2=========
   3
   4NAME
   5----
   6git-rm - Remove files from the working tree and from the index
   7
   8SYNOPSIS
   9--------
  10'git rm' [-f] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>...
  11
  12DESCRIPTION
  13-----------
  14Remove files from the index, or from the working tree and the index.
  15'git-rm' will not remove a file from just your working directory.
  16(There is no option to remove a file only from the work tree
  17and yet keep it in the index; use `/bin/rm` if you want to do that.)
  18The files being removed have to be identical to the tip of the branch,
  19and no updates to their contents can be staged in the index,
  20though that default behavior can be overridden with the `-f` option.
  21When '--cached' is given, the staged content has to
  22match either the tip of the branch or the file on disk,
  23allowing the file to be removed from just the index.
  24
  25
  26OPTIONS
  27-------
  28<file>...::
  29        Files to remove.  Fileglobs (e.g. `*.c`) can be given to
  30        remove all matching files.  If you want git to expand
  31        file glob characters, you may need to shell-escape them.
  32        A leading directory name
  33        (e.g. `dir` to remove `dir/file1` and `dir/file2`) can be
  34        given to remove all files in the directory, and recursively
  35        all sub-directories,
  36        but this requires the `-r` option to be explicitly given.
  37
  38-f::
  39        Override the up-to-date check.
  40
  41-n::
  42--dry-run::
  43        Don't actually remove any file(s).  Instead, just show
  44        if they exist in the index and would otherwise be removed
  45        by the command.
  46
  47-r::
  48        Allow recursive removal when a leading directory name is
  49        given.
  50
  51\--::
  52        This option can be used to separate command-line options from
  53        the list of files, (useful when filenames might be mistaken
  54        for command-line options).
  55
  56--cached::
  57        Use this option to unstage and remove paths only from the index.
  58        Working tree files, whether modified or not, will be
  59        left alone.
  60
  61--ignore-unmatch::
  62        Exit with a zero status even if no files matched.
  63
  64-q::
  65--quiet::
  66        'git-rm' normally outputs one line (in the form of an "rm" command)
  67        for each file removed. This option suppresses that output.
  68
  69
  70DISCUSSION
  71----------
  72
  73The <file> list given to the command can be exact pathnames,
  74file glob patterns, or leading directory names.  The command
  75removes only the paths that are known to git.  Giving the name of
  76a file that you have not told git about does not remove that file.
  77
  78File globbing matches across directory boundaries.  Thus, given
  79two directories `d` and `d2`, there is a difference between
  80using `git rm \'d\*\'` and `git rm \'d/\*\'`, as the former will
  81also remove all of directory `d2`.
  82
  83EXAMPLES
  84--------
  85git rm Documentation/\\*.txt::
  86        Removes all `\*.txt` files from the index that are under the
  87        `Documentation` directory and any of its subdirectories.
  88+
  89Note that the asterisk `\*` is quoted from the shell in this
  90example; this lets git, and not the shell, expand the pathnames
  91of files and subdirectories under the `Documentation/` directory.
  92
  93git rm -f git-*.sh::
  94        Because this example lets the shell expand the asterisk
  95        (i.e. you are listing the files explicitly), it
  96        does not remove `subdir/git-foo.sh`.
  97
  98SEE ALSO
  99--------
 100linkgit:git-add[1]
 101
 102Author
 103------
 104Written by Linus Torvalds <torvalds@osdl.org>
 105
 106Documentation
 107--------------
 108Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
 109
 110GIT
 111---
 112Part of the linkgit:git[1] suite