LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

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.
-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
copy
sudo dnf install git
copy
sudo pacman -S git
copy
sudo apk add git
copy
sudo zypper install git
copy
brew install git
copy
nix profile install nixpkgs#git
copy

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

RESOURCES

Copied to clipboard
Kai