Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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?

like image 977
Bohr Avatar asked Jun 28 '13 06:06

Bohr


1 Answers

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
like image 52
VonC Avatar answered Sep 28 '22 11:09

VonC