gitignore, excludesfile

contents — the rulesets, the worktree traversal ommisions

Git does not traverse directories excluded in excludesfiles. Thus to exclude everything in a directory besides something, you have to first exclude ** under that directory, and then add negating patterns for each of the subdirectories leading to the files, ending with the negating pattern for the file.

loading — the files, the filenames

Firstly, .gitignore files from the directory subtree of $GIT_WORK_TREE.

Then, $GIT_DIR/info/exclude. This one is not recommended to be staged.

Now, there is core.excludesFile git config entry. I am guessing that there can be just one core.excludesFile. Hence if you set it to something else in your repository's /.gitconfig or in $GIT_CONFIG, the one that you defined in your ~/.gitconfig, nor $XDG_CONFIG_HOME/git/ignore, are not loaded.