Documentation / git-rm.txton commit Merge branch 'maint' (237ce83)
   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 working tree and from the index.  The
  15files have to be identical to the tip of the branch, and no
  16updates to its contents must have been placed in the staging
  17area (aka index).
  18
  19
  20OPTIONS
  21-------
  22<file>...::
  23        Files to remove.  Fileglobs (e.g. `*.c`) can be given to
  24        remove all matching files.  Also a leading directory name
  25        (e.g. `dir` to add `dir/file1` and `dir/file2`) can be
  26        given to remove all files in the directory, recursively,
  27        but this requires `-r` option to be given for safety.
  28
  29-f::
  30        Override the up-to-date check.
  31
  32-n::
  33        Don't actually remove the file(s), just show if they exist in
  34        the index.
  35
  36-r::
  37        Allow recursive removal when a leading directory name is
  38        given.
  39
  40\--::
  41        This option can be used to separate command-line options from
  42        the list of files, (useful when filenames might be mistaken
  43        for command-line options).
  44
  45\--cached::
  46        This option can be used to tell the command to remove
  47        the paths only from the index, leaving working tree
  48        files.
  49
  50\--ignore-unmatch::
  51        Exit with a zero status even if no files matched.
  52
  53\--quiet::
  54        git-rm normally outputs one line (in the form of an "rm" command)
  55        for each file removed. This option suppresses that output.
  56
  57
  58DISCUSSION
  59----------
  60
  61The list of <file> given to the command can be exact pathnames,
  62file glob patterns, or leading directory name.  The command
  63removes only the paths that is known to git.  Giving the name of
  64a file that you have not told git about does not remove that file.
  65
  66
  67EXAMPLES
  68--------
  69git-rm Documentation/\\*.txt::
  70        Removes all `\*.txt` files from the index that are under the
  71        `Documentation` directory and any of its subdirectories.
  72+
  73Note that the asterisk `\*` is quoted from the shell in this
  74example; this lets the command include the files from
  75subdirectories of `Documentation/` directory.
  76
  77git-rm -f git-*.sh::
  78        Remove all git-*.sh scripts that are in the index.
  79        Because this example lets the shell expand the asterisk
  80        (i.e. you are listing the files explicitly), it
  81        does not remove `subdir/git-foo.sh`.
  82
  83See Also
  84--------
  85gitlink:git-add[1]
  86
  87Author
  88------
  89Written by Linus Torvalds <torvalds@osdl.org>
  90
  91Documentation
  92--------------
  93Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
  94
  95GIT
  96---
  97Part of the gitlink:git[7] suite