View Files in the Current Git Repository
What Do You Want to See
| What to See | Recommended Command | Notes |
|---|---|---|
| Files tracked by Git | git ls-files | Only files already under version control |
| Modified but not yet staged files | git diff --name-only | Only lists working directory changes relative to staging |
| Already staged files | git diff --cached --name-only | Only see what the next commit will include |
| Untracked files | git ls-files --others --exclude-standard | Excludes .gitignore and other ignore rules |
| Ignored files | git ls-files --others -i --exclude-standard | Only see ignored untracked files |
| Overall status at a glance | git status --short --ignored | Best for daily troubleshooting |
Recommended Commands
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-filesdoesn't show untracked files and won't directly tell you if files have been modified.git statusdoesn't show ignored files by default; add--ignoredif you want to see them too.- If you suspect a file has "disappeared," use
git statusto determine whether it was deleted, is untracked, or is ignored -- don't rely solely ongit ls-files.