LinuxCommandLibrary

git-ls-files

List files in index and working tree

TLDR

List tracked files

$ git ls-files
copy
List untracked files
$ git ls-files --others
copy
List ignored files
$ git ls-files --ignored --exclude-standard
copy
List modified files
$ git ls-files --modified
copy
List deleted files
$ git ls-files --deleted
copy

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.
--help
Display help information.

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community