Skip to content

Commit 6a7aca6

Browse files
SyntevoAlexgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2323784 commit 6a7aca6

File tree

1 file changed

+21
-29
lines changed

1 file changed

+21
-29
lines changed

Documentation/git-rm.txt

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ git-rm - Remove files from the working tree and from the index
88
SYNOPSIS
99
--------
1010
[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>...
1212

1313
DESCRIPTION
1414
-----------
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,
2121
though that default behavior can be overridden with the `-f` option.
2222
When `--cached` is given, the staged content has to
2323
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.
2626

2727
OPTIONS
2828
-------
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].
3843

3944
-f::
4045
--force::
@@ -69,19 +74,6 @@ OPTIONS
6974
for each file removed. This option suppresses that output.
7075

7176

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-
8577
REMOVING FILES THAT HAVE DISAPPEARED FROM THE FILESYSTEM
8678
--------------------------------------------------------
8779
There is no option for `git rm` to remove from the index only

0 commit comments

Comments
 (0)