Skip to main content

View Files in the Current Git Repository

What Do You Want to See

What to SeeRecommended CommandNotes
Files tracked by Gitgit ls-filesOnly files already under version control
Modified but not yet staged filesgit diff --name-onlyOnly lists working directory changes relative to staging
Already staged filesgit diff --cached --name-onlyOnly see what the next commit will include
Untracked filesgit ls-files --others --exclude-standardExcludes .gitignore and other ignore rules
Ignored filesgit ls-files --others -i --exclude-standardOnly see ignored untracked files
Overall status at a glancegit status --short --ignoredBest for daily troubleshooting

View Tracked Files

git ls-files

View Untracked Files

git ls-files --others --exclude-standard

View Ignored Files

git ls-files --others -i --exclude-standard

View Modified, Staged, Untracked, and Ignored Files All at Once

git status --short --ignored

How to Read the Output

The first two columns of git status --short represent "staging area status" and "working directory status":

  • M file.txt: File has staged modifications.
  • M file.txt: File modified in working directory, not yet staged.
  • A file.txt: New file has been staged.
  • ?? file.txt: Untracked file.
  • !! file.txt: Ignored file.

If you only care about the file list and not the content diff, commands with --name-only are faster.

Common Combinations

git status --short
git diff --name-only
git diff --cached --name-only
git check-ignore -v path/to/file
  • git diff --name-only -- confirm which tracked files haven't been staged yet.
  • git diff --cached --name-only -- double-check before committing.
  • git check-ignore -v path/to/file -- tells you why a file is ignored and which rule matched.

Notes

  • git ls-files doesn't show untracked files and won't directly tell you if files have been modified.
  • git status doesn't show ignored files by default; add --ignored if you want to see them too.
  • If you suspect a file has "disappeared," use git status to determine whether it was deleted, is untracked, or is ignored -- don't rely solely on git ls-files.