List untracked files only
List untracked files only with git ls-files -o --exclude-standard. Without the second option the output includes every ignored build file as well.
You want the files Git does not know about yet, without the build output a .gitignore already hides.
git init -q demo && cd demo
printf 'build/\n*.log\n' > .gitignore
mkdir build && touch build/app.o debug.log notes.txt tracked.txt
git add tracked.txt .gitignore
git ls-files -o
echo ---
git ls-files -o --exclude-standardbuild/app.o
debug.log
notes.txt
---
notes.txt-o (--others) lists files that are not in the index, and --exclude-standard applies the usual ignore rules: .gitignore, .git/info/exclude and the global ignore file. The options are in the git-ls-files manual. The first list shows why the second option matters, since the ignored directory and log appear without it.
Directories that hold only untracked files are listed file by file, unless you add --directory. File names with unusual characters are quoted in the output, so use -z with xargs -0 when feeding the list to another command.