doc: rm: synchronize <pathspec> description
This patch continues the effort that is already applied to `git commit`, `git reset`, `git checkout` etc. 1) Changed outdated descriptions to mention pathspec instead. 2) Added reference to 'linkgit:gitglossary[7]'. 3) Removed content that merely repeated gitglossary. 4) Merged the remainder of "discussion" into `<patchspec>`. Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alexandr Miloslavskiy committed
Jan 16, 2020 at 16:09 UTC
6a7aca6f016e397838926250764318b767650bd5
1 file changed
+21
-29
Documentation/git-rm.txt
+21
-29
@@ -8,16 +8,16 @@ git-rm - Remove files from the working tree and from the index
8
SYNOPSIS
9
--------
10
[verse]
11
-'git rm' [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>...
11
+'git rm' [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <pathspec>...
12
13
DESCRIPTION
14
-----------
15
-Remove files from the index, or from the working tree and the index.
16
-`git rm` will not remove a file from just your working directory.
17
-(There is no option to remove a file only from the working tree
18
-and yet keep it in the index; use `/bin/rm` if you want to do that.)
19
-The files being removed have to be identical to the tip of the branch,
20
-and no updates to their contents can be staged in the index,
15
+Remove files matching pathspec from the index, or from the working tree
16
+and the index. `git rm` will not remove a file from just your working
17
+directory. (There is no option to remove a file only from the working
18
+tree and yet keep it in the index; use `/bin/rm` if you want to do
19
+that.) The files being removed have to be identical to the tip of the
20
+branch, and no updates to their contents can be staged in the index,
21
though that default behavior can be overridden with the `-f` option.
22
When `--cached` is given, the staged content has to
23
match either the tip of the branch or the file on disk,
@@ -26,15 +26,20 @@ allowing the file to be removed from just the index.
26
27
OPTIONS
28
-------
29
-<file>...::
30
- Files to remove. Fileglobs (e.g. `*.c`) can be given to
31
- remove all matching files. If you want Git to expand
32
- file glob characters, you may need to shell-escape them.
33
- A leading directory name
34
- (e.g. `dir` to remove `dir/file1` and `dir/file2`) can be
35
- given to remove all files in the directory, and recursively
36
- all sub-directories,
37
- but this requires the `-r` option to be explicitly given.
29
+<pathspec>...::
30
+ Files to remove. A leading directory name (e.g. `dir` to remove
31
+ `dir/file1` and `dir/file2`) can be given to remove all files in
32
+ the directory, and recursively all sub-directories, but this
33
+ requires the `-r` option to be explicitly given.
34
++
35
+The command removes only the paths that are known to Git.
36
++
37
+File globbing matches across directory boundaries. Thus, given two
38
+directories `d` and `d2`, there is a difference between using
39
+`git rm 'd*'` and `git rm 'd/*'`, as the former will also remove all
40
+of directory `d2`.
41
++
42
+For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
43
44
-f::
45
--force::
@@ -69,19 +74,6 @@ OPTIONS
74
for each file removed. This option suppresses that output.
75
76
72
-DISCUSSION
73
-----------
74
-
75
-The <file> list given to the command can be exact pathnames,
76
-file glob patterns, or leading directory names. The command
77
-removes only the paths that are known to Git. Giving the name of
78
-a file that you have not told Git about does not remove that file.
79
-
80
-File globbing matches across directory boundaries. Thus, given
81
-two directories `d` and `d2`, there is a difference between
82
-using `git rm 'd*'` and `git rm 'd/*'`, as the former will
83
-also remove all of directory `d2`.
84
-
77
REMOVING FILES THAT HAVE DISAPPEARED FROM THE FILESYSTEM
78
--------------------------------------------------------
79
There is no option for `git rm` to remove from the index only