git-ls-files
List files in index and working tree
TLDR
List tracked files
$ git ls-files
List untracked files$ git ls-files --others
List ignored files$ git ls-files --ignored --exclude-standard
List modified files$ git ls-files --modified
List deleted files$ git ls-files --deleted
SYNOPSIS
git ls-files [options] [files]
DESCRIPTION
git ls-files lists files in the index and working tree. It can show tracked, untracked, ignored, modified, and deleted files, making it valuable for scripting and automation.The command provides low-level access to Git's file tracking state. Various flags control which file categories to display. It is commonly used in scripts to enumerate files matching certain criteria, such as finding all untracked files or listing everything ignored by `.gitignore`.
PARAMETERS
--cached, -c
Show staged files (default).--modified, -m
Show modified files.--deleted, -d
Show deleted files.--others, -o
Show untracked files.--ignored
Show ignored files.--exclude-standard
Use standard exclusions.--stage, -s
Show staging info.-x pattern, --exclude pattern
Skip files matching pattern.-z
Terminate entries with NUL instead of newline, for safe scripting.--full-name
Show paths relative to the repository root, not the current directory.--help
Display help information.
INSTALL
sudo apt install git
sudo dnf install git
sudo pacman -S git
sudo apk add git
sudo zypper install git
brew install git
nix profile install nixpkgs#git
CAVEATS
Shows index state, not commits. Output format varies by options. Useful for scripting.
HISTORY
git ls-files is a core Git plumbing command for inspecting the index, used both directly and by other git commands.
SEE ALSO
git-status(1), git-ls-tree(1)