How to See Ignored Files in Git with git status --ignored
A .gitignore file keeps files out of Git, but plain git status never mentions them, so you can't tell whether your rules really match. git status --ignored adds them to the list. It's the quickest way to check a .gitignore before the first commit. This guide uses it on Git 2.56.1.
Syntax
git status --ignored
git status --short --ignored
| Part | What it means |
|---|---|
--ignored | Also list the files and folders that Git ignores |
--short | One line per entry: ?? for untracked, !! for ignored |
The git status documentation describes --ignored as "Show ignored files as well", and says that in the short format "ignored files are indicated by !!".
The Example
A new repository holds app.py, a cache folder, a debug.log file, and a .gitignore with two rules:
cache/
*.log
Step 1: Look at the Normal Status
git status --short
?? .gitignore
?? app.py
Only the two files Git would add are listed. cache/ and debug.log don't appear at all, which looks right but proves nothing.
Step 2: Add the Ignored Files
git status --short --ignored
?? .gitignore
?? app.py
!! cache/
!! debug.log

Now the ignored entries show up, marked !!: the folder through cache/ and the log through *.log. Both rules work.
Step 3: The Long Format
git status --ignored
On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
app.py
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
cache/
debug.log
nothing added to commit but untracked files present (use "git add" to track)
The long format gives the ignored entries a section of their own, Ignored files. The hint under it, git add -f, is how you would add an ignored file on purpose. The commands work unchanged in PowerShell.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Trusting plain git status to check a .gitignore | Ignored and missing files look the same: absent | Check with --ignored |
| Expecting a file Git already tracks to show as ignored | .gitignore only affects untracked files, so a tracked file stays tracked | Stop tracking it with git rm --cached <file> |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
A file you meant to ignore shows ?? instead of !! | The pattern doesn't match it | Fix the pattern, then check again |
A file shows !! that you want to commit | A rule matches it | Narrow the rule, or add the file with git add -f |
FAQ
What do ?? and !! mean?
?? is an untracked file Git would add with git add .. !! is a file Git ignores because of a rule.
Does --ignored change anything?
No. It only lists more. Your repository and .gitignore stay as they are.
Conclusion
git status --short listed only .gitignore and app.py, and --ignored added cache/ and debug.log marked !!, proving both rules matched. Run it whenever you change a .gitignore.
Additional Resources
- git status —
--ignoredand its modes, and the short format. - gitignore — how patterns match.
