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