Git allows certain files and directories to be excluded from version control by defining patterns in a .gitignore file. These entries are useful for keeping generated files, cache, IDE settings, dependencies, and other unnecessary content out of the repository. When working with an existing project, it can be useful to see which files are currently being ignored by Git. This tutorial shows how to get a list of ignored files in Git.
The git status command provides --ignored option specifically for displaying ignored files.
git status --ignored
The command displays the regular repository status along with a separate Ignored files section. For example:
On branch master
Your branch is up to date with 'origin/master'.
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
.idea/
var/cache/
vendor/
nothing to commit, working tree clean
In this example, .idea/, var/cache/, and vendor/ are recognized as ignored paths.
Leave a Comment
Cancel reply