Skip to content

Commit d0ab520

Browse files
committed
Merge branch 'maint-1.5.4' into maint
* maint-1.5.4: git-am: minor cleanup Clarify and fix English in "git-rm" documentation
2 parents 464509f + 11dc4e7 commit d0ab520

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

Documentation/git-rm.txt

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,37 @@ SYNOPSIS
1111

1212
DESCRIPTION
1313
-----------
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). When --cached is given, the staged content has to
18-
match either the tip of the branch *or* the file on disk.
14+
Remove files from the index, or from the working tree and the index.
15+
`git rm` will not remove a file from just your working directory.
16+
(There is no option to remove a file only from the work tree
17+
and yet keep it in the index; use `/bin/rm` if you want to do that.)
18+
The files being removed have to be identical to the tip of the branch,
19+
and no updates to their contents can be staged in the index,
20+
though that default behavior can be overridden with the `-f` option.
21+
When '--cached' is given, the staged content has to
22+
match either the tip of the branch or the file on disk,
23+
allowing the file to be removed from just the index.
1924

2025

2126
OPTIONS
2227
-------
2328
<file>...::
2429
Files to remove. Fileglobs (e.g. `*.c`) can be given to
25-
remove all matching files. Also a leading directory name
26-
(e.g. `dir` to add `dir/file1` and `dir/file2`) can be
27-
given to remove all files in the directory, recursively,
28-
but this requires `-r` option to be given for safety.
30+
remove all matching files. If you want git to expand
31+
file glob characters, you may need to shell-escape them.
32+
A leading directory name
33+
(e.g. `dir` to remove `dir/file1` and `dir/file2`) can be
34+
given to remove all files in the directory, and recursively
35+
all sub-directories,
36+
but this requires the `-r` option to be explicitly given.
2937

3038
-f::
3139
Override the up-to-date check.
3240

3341
-n, \--dry-run::
34-
Don't actually remove the file(s), just show if they exist in
35-
the index.
42+
Don't actually remove any file(s). Instead, just show
43+
if they exist in the index and would otherwise be removed
44+
by the command.
3645

3746
-r::
3847
Allow recursive removal when a leading directory name is
@@ -44,9 +53,9 @@ OPTIONS
4453
for command-line options).
4554

4655
\--cached::
47-
This option can be used to tell the command to remove
48-
the paths only from the index, leaving working tree
49-
files.
56+
Use this option to unstage and remove paths only from the index.
57+
Working tree files, whether modified or not, will be
58+
left alone.
5059

5160
\--ignore-unmatch::
5261
Exit with a zero status even if no files matched.
@@ -59,11 +68,15 @@ OPTIONS
5968
DISCUSSION
6069
----------
6170

62-
The list of <file> given to the command can be exact pathnames,
63-
file glob patterns, or leading directory name. The command
64-
removes only the paths that is known to git. Giving the name of
71+
The <file> list given to the command can be exact pathnames,
72+
file glob patterns, or leading directory names. The command
73+
removes only the paths that are known to git. Giving the name of
6574
a file that you have not told git about does not remove that file.
6675

76+
File globbing matches across directory boundaries. Thus, given
77+
two directories `d` and `d2`, there is a difference between
78+
using `git rm \'d\*\'` and `git rm \'d/\*\'`, as the former will
79+
also remove all of directory `d2`.
6780

6881
EXAMPLES
6982
--------
@@ -72,11 +85,10 @@ git-rm Documentation/\\*.txt::
7285
`Documentation` directory and any of its subdirectories.
7386
+
7487
Note that the asterisk `\*` is quoted from the shell in this
75-
example; this lets the command include the files from
76-
subdirectories of `Documentation/` directory.
88+
example; this lets git, and not the shell, expand the pathnames
89+
of files and subdirectories under the `Documentation/` directory.
7790

7891
git-rm -f git-*.sh::
79-
Remove all git-*.sh scripts that are in the index.
8092
Because this example lets the shell expand the asterisk
8193
(i.e. you are listing the files explicitly), it
8294
does not remove `subdir/git-foo.sh`.

git-am.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ do
383383
;;
384384
esac
385385
esac
386-
FIRSTLINE=$(head -1 "$dotest/final-commit")
387386

388387
resume=
389388
if test "$interactive" = t
@@ -404,7 +403,6 @@ do
404403
[aA]*) action=yes interactive= ;;
405404
[nN]*) action=skip ;;
406405
[eE]*) git_editor "$dotest/final-commit"
407-
FIRSTLINE=$(head -1 "$dotest/final-commit")
408406
action=again ;;
409407
[vV]*) action=again
410408
LESS=-S ${PAGER:-less} "$dotest/patch" ;;
@@ -414,6 +412,7 @@ do
414412
else
415413
action=yes
416414
fi
415+
FIRSTLINE=$(head -1 "$dotest/final-commit")
417416

418417
if test $action = skip
419418
then

0 commit comments

Comments
 (0)