简体   繁体   English

如何在git存储库中列出所有缓存文件和未跟踪文件?

[英]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 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? 但我想知道是否有一个git本地做这个让它可移植?

Simple trick (using git clean ): 简单的技巧(使用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 ) (从git-ready

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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