简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM