If you just need a valid list of files ignored (no matter how they got ignored), and without any extra notice and logs.
Once created, anywhere (in Git-bash) run:
git ignore-list
Create it by executing:
git config --global alias.ignore-list "! cd -- \"\${GIT_PREFIX:-.}\" && git ls-files -v \${1:-.} | sed -n -e \"s,^[a-z] \(.*\)$,\${GIT_PREFIX:-./}\1,p\" && git status --ignored --porcelain \${1:-.} 2>/dev/null | sed -n -e \"s/^\(\\!\\! \)\(.*\)$/\2/p\" #"
Example usage, Assuming it's the initial commit and you want to push everything, try:
git ignore-list | xargs git add -f
Notes:
- It's tested and works on both
macOSandWindowsplatforms! - Once you
cdinto a directory, lists only files ignored from that dir (or its sub-dirs). - And lastly, always logs paths relative to root-dir (which contains
.gitdir, no matter what dir youcdinto).
Another useful thing is Human-readability, like if an entire directory is ignored, something like build or node_modules, this will log dir-name only.
While git ls-files --others -i --exclude-standard command logs each and every file (good for xargs).