How to make a list of all the cached files and untracked files in a git repository?

git

Solution

Simple trick (using `git clean`):

git clean -n -d -x

That would list (as to be removed) all ignored and private files.

But that isn't based on a plumbing command.

Maybe:

git ls-files --others --exclude-standard -z

(From git-ready)

--others             lists untracked files
--exclude-standard   uses .gitignore and the default git excludes
-z                   null-delimited output

Problem

`git ls-files` does not provide a way to do this, so I come up with this: `git ls-files; git status --porcelain | grep ^?? | cut -d' ' -f2` But I wonder if there is a git native to do this to make it portable?

Original source