]> git.ipfire.org Git - thirdparty/git.git/blob - Documentation/git-rm.txt
Merge master.kernel.org:/pub/scm/gitk/gitk
[thirdparty/git.git] / Documentation / git-rm.txt
1 git-rm(1)
2 =========
3
4 NAME
5 ----
6 git-rm - Remove files from the working tree and from the index
7
8 SYNOPSIS
9 --------
10 'git-rm' [-f] [-n] [-v] [--] <file>...
11
12 DESCRIPTION
13 -----------
14 A convenience wrapper for git-update-index --remove. For those coming
15 from cvs, git-rm provides an operation similar to "cvs rm" or "cvs
16 remove".
17
18
19 OPTIONS
20 -------
21 <file>...::
22 Files to remove from the index and optionally, from the
23 working tree as well.
24
25 -f::
26 Remove files from the working tree as well as from the index.
27
28 -n::
29 Don't actually remove the file(s), just show if they exist in
30 the index.
31
32 -v::
33 Be verbose.
34
35 \--::
36 This option can be used to separate command-line options from
37 the list of files, (useful when filenames might be mistaken
38 for command-line options).
39
40
41 DISCUSSION
42 ----------
43
44 The list of <file> given to the command is fed to `git-ls-files`
45 command to list files that are registered in the index and
46 are not ignored/excluded by `$GIT_DIR/info/exclude` file or
47 `.gitignore` file in each directory. This means two things:
48
49 . You can put the name of a directory on the command line, and the
50 command will remove all files in it and its subdirectories (the
51 directories themselves are never removed from the working tree);
52
53 . Giving the name of a file that is not in the index does not
54 remove that file.
55
56
57 EXAMPLES
58 --------
59 git-rm Documentation/\\*.txt::
60
61 Removes all `\*.txt` files from the index that are under the
62 `Documentation` directory and any of its subdirectories. The
63 files are not removed from the working tree.
64 +
65 Note that the asterisk `\*` is quoted from the shell in this
66 example; this lets the command include the files from
67 subdirectories of `Documentation/` directory.
68
69 git-rm -f git-*.sh::
70
71 Remove all git-*.sh scripts that are in the index. The files
72 are removed from the index, and (because of the -f option),
73 from the working tree as well. Because this example lets the
74 shell expand the asterisk (i.e. you are listing the files
75 explicitly), it does not remove `subdir/git-foo.sh`.
76
77 See Also
78 --------
79 gitlink:git-add[1]
80
81 Author
82 ------
83 Written by Linus Torvalds <torvalds@osdl.org>
84
85 Documentation
86 --------------
87 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
88
89 GIT
90 ---
91 Part of the gitlink:git[7] suite
92