I am trying to get a list of untracked files to use programmatically.
However I can't seem to get git to report untracked files inside untracked directories. It always just lists the lowest level directory that contains files.
I've tried:
git status --untracked-files=all
and
git ls-files --others --exclude-standard
Staging any file in the directory makes git report all other files in the directory, but I don't really want to do that.
Also, I could use bash to list all the files - but then I would have to get git to tell me which of those are gitignored.
Is there any way to do this purely with git? Or otherwise an efficient way to do this with other tools?
git status --untracked-files=all
should be equivalent togit status -u
, and that should show untracked files in directories where no other file is tracked. That still doesn't work for you? – Insomniacgit status --untracked-files=all
andgit ls-files --others --exclude-standard
seem to give the results you desire, i.e. listing all the untracked but not ignored files individually. – Mettsgit status -uall
andgit ls-files --others --exclude-standard
(both of which go back a long way)... – Alexandria