简体   繁体   中英

How to list all clean files in a git repository?

Basically I am searching for the git equivalent to hg status -c :

-c --clean show only files without changes

Calling git status lists by default all 'dirty' files (ie files with changes) and untracked ones - which is fine.

But sometimes I need to display the complement - all (tracked) files without changes.

How do I accomplish this with 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. The alternatives the man page mentions does not seem to be sufficient for this problem.

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