Search code examples
gitstatus

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 (i.e. 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?


Solution

  • $ 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.