Skip to content

Commit 4986662

Browse files
committed
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 dda2d79 ([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 <[email protected]>
1 parent b9b439e commit 4986662

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Documentation/diff-options.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,13 @@ explained for the configuration variable `core.quotePath` (see
318318
linkgit:git-config[1]).
319319

320320
--name-only::
321-
Show only names of changed files. The file names are often encoded in UTF-8.
321+
Show only the name of each changed file in the post-image tree.
322+
The file names are often encoded in UTF-8.
322323
For more information see the discussion about encoding in the linkgit:git-log[1]
323324
manual page.
324325

325326
--name-status::
326-
Show only names and status of changed files. See the description
327+
Show only the name(s) and status of each changed file. See the description
327328
of the `--diff-filter` option on what the status letters mean.
328329
Just like `--name-only` the file names are often encoded in UTF-8.
329330

0 commit comments

Comments
 (0)