[Git] List the files tracked in the index

Created on November 30, 2026

Use git ls-files to list Git's indexed paths. This example stages README.md and src/main.js in a repository and leaves memo.txt untracked.

mkdir -p src
touch README.md src/main.js memo.txt
git init -q
git add README.md src/main.js
git ls-files
README.md
src/main.js

The list includes files that you have staged even if you have yet to commit them. Use git ls-tree to inspect the files in a specific revision.

Reference

Git