git-diff-files
Show changes between the index and filesystem
TLDR
Compare all changed files
Compare only specified files
Show only the names of changed files
Output a summary of extended header information
SYNOPSIS
git diff-files [--raw] [--name-only | --name-status] [-z] [--diff-filter=filter] [-- path...]
PARAMETERS
--raw
Show the raw diff output. This format is designed for easy parsing by scripts.
--name-only
Show only the names of the files that differ, one per line.
--name-status
Show only the names and status letters of the files that differ (e.g., A for added, M for modified, D for deleted).
-z
Separate the pathnames with a NUL character instead of a newline. This is useful for scripting when dealing with pathnames that may contain spaces or other special characters.
--diff-filter=filter
Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type changed (T), are Unmerged (U), are Unknown (X), or have Broken pairing (B). Any combination of these characters can be used.
-- path...
Limit the diff to the specified paths. This separator (--) is optional but recommended to distinguish paths from options.
DESCRIPTION
The git-diff-files command, typically invoked via git diff-files, serves as a low-level plumbing command in Git. Its primary function is to compare the contents and metadata of files in your current working directory against their versions stored in the Git index (also known as the staging area).
Unlike the more common git diff which offers various comparison modes (e.g., between commits, branches), git-diff-files focuses solely on the unstaged changes. It is designed for scripting and internal Git operations, providing raw, precise information about what has changed in the working tree relative to what is prepared for the next commit.
It can report added, modified, deleted, renamed, copied, or type-changed files, making it a foundational tool for building more complex Git workflows and utilities.
CAVEATS
git-diff-files is primarily a plumbing command. For general interactive use, git diff (specifically git diff --no-index or git diff without arguments) is usually more appropriate and user-friendly. This command only compares the working directory against the index; it cannot compare against commits or other references.
USAGE PATTERN
While the executable is named git-diff-files, it is almost always invoked indirectly through the main git command as git diff-files. Direct execution of git-diff-files is rare and typically not required for standard Git operations.
HISTORY
git-diff-files is one of the foundational low-level commands introduced early in Git's development. It provides the core mechanism for comparing changes between the working tree and the index, which is fundamental to Git's staging area concept and how it tracks uncommitted changes. Its design as a 'plumbing' command reflects Git's philosophy of providing basic, composable tools.
SEE ALSO
git-diff(1), git-ls-files(1), git-update-index(1)