You can list all files ignored by git in current directory with command:
git status --ignored
So if we have repository structure like this:
.git
.gitignore
./example_1
./dir/example_2
./example_2
...and .gitignore file containing:
example_2
...than result of the command will be:
$ git status --ignored
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
.example_1
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
dir/
example_2
If you want to list recursively ignored files in directories, you have to use additional parameter - --untracked-files=all
Result will look like this:
$ git status --ignored --untracked-files=all
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
example_1
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
dir/example_2
example_2