git-rm: Documentation
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 25, 2006 at 03:23 UTC
08d22488a65fde7d570bd4ea57626f5352b9b064
1 file changed
+27
-24
Documentation/git-rm.txt
+27
-24
@@ -7,51 +7,54 @@ git-rm - Remove files from the working tree and from the index
7
8
SYNOPSIS
9
--------
10
-'git-rm' [-f] [-n] [-v] [--] <file>...
10
+'git-rm' [-f] [-n] [-r] [--cached] [--] <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".
14
+Remove files from the working tree and from the index. The
15
+files have to be identical to the tip of the branch, and no
16
+updates to its contents must have been placed in the staging
17
+area (aka index).
18
19
20
OPTIONS
21
-------
22
<file>...::
22
- Files to remove from the index and optionally, from the
23
- working tree as well.
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::
26
- Remove files from the working tree as well as from the index.
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
32
--v::
33
- Be verbose.
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
51
DISCUSSION
52
----------
53
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.
54
+The list of <file> given to the command can be exact pathnames,
55
+file glob patterns, or leading directory name. The command
56
+removes only the paths that is known to git. Giving the name of
57
+a file that you have not told git about does not remove that file.
58
59
60
EXAMPLES
@@ -69,10 +72,10 @@ subdirectories of `Documentation/` directory.
72
git-rm -f git-*.sh::
73
74
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`.
75
+ are removed from the index, and from the working
76
+ tree. Because this example lets the shell expand the
77
+ asterisk (i.e. you are listing the files explicitly), it
78
+ does not remove `subdir/git-foo.sh`.
79
80
See Also
81
--------