diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-05-17 19:14:46 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-05-17 20:03:08 +0200 |
commit | 4986662cbc2c366d1db9207ff53dfc0d01f8b4dd (patch) | |
tree | f9b9410b2c93a3f81a91a0267a83ba8871837d7c /Documentation/diff-options.txt | |
parent | Git 2.40.2 (diff) | |
download | git-4986662cbc2c366d1db9207ff53dfc0d01f8b4dd.tar.xz git-4986662cbc2c366d1db9207ff53dfc0d01f8b4dd.zip |
diff: document what --name-only shows
The "--name-only" option is about showing the name of each file in
the post-image tree that got changed and nothing else (like "was it
created?"). Unlike the "--name-status" option that tells how the
change happened (e.g., renamed with similarity), it does not give
anything else, like the name of the corresponding file in the old
tree.
For example, if you start from a clean checkout that has a file
whose name is COPYING, here is what you would see:
$ git mv COPYING RENAMING
$ git diff -M --name-only HEAD
RENAMING
$ git diff -M --name-status HEAD
R100 COPYING RENAMING
Lack of the description of this fact has confused readers in the
past. Even back when dda2d79a ([PATCH] Clean up diff option
descriptions., 2005-07-13) documented "--name-only", "git diff"
already supported the renames, so in a sense, from day one, this
should have been documented more clearly but it wasn't.
Belatedly clarify it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r-- | Documentation/diff-options.txt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 7d73e976d9..0c456dfd0c 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -318,12 +318,13 @@ explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). --name-only:: - Show only names of changed files. The file names are often encoded in UTF-8. + Show only the name of each changed file in the post-image tree. + The file names are often encoded in UTF-8. For more information see the discussion about encoding in the linkgit:git-log[1] manual page. --name-status:: - Show only names and status of changed files. See the description + Show only the name(s) and status of each changed file. See the description of the `--diff-filter` option on what the status letters mean. Just like `--name-only` the file names are often encoded in UTF-8. |