简体   繁体   English

如何列出git存储库中的所有干净文件?

[英]How to list all clean files in a git repository?

Basically I am searching for the git equivalent to hg status -c : 基本上我正在搜索与hg status -c等效的git:

-c --clean show only files without changes -c --clean仅显示未更改的文件

Calling git status lists by default all 'dirty' files (ie files with changes) and untracked ones - which is fine. 默认情况下,调用git status列表会列出所有“脏”文件(即具有更改的文件)和未跟踪的文件-很好。

But sometimes I need to display the complement - all (tracked) files without changes. 但是有时候我需要显示补码-所有(跟踪的)文件都没有更改。

How do I accomplish this with git? 如何使用git完成此操作?

this should do the trick: 这应该可以解决问题:

$ git ls-files -m  > /dev/shm/exclude && git ls-files | grep -v -x -f /dev/shm/exclude

Remember to delete the temporary file afterwards! 请记住,之后要删除临时文件!

$ git ls-files -t | grep '^H'

The man page states that -t is deprecated - but I didn't find a better way. 手册页指出-t已过时-但我没有找到更好的方法。 The alternatives the man page mentions does not seem to be sufficient for this problem. 手册页中提到的替代方法似乎不足以解决此问题。

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

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