Search code examples
gitbashunixversion-controlgrep

Getting a list of all unversioned files in a Git-controlled folder


Getting a list of unversioned files in a Git-controlled folder is way more annoying than it needs to be. Unless I really suck at reading man pages, it doesn't look like Git provides a facility to perform this operation on its own.

There may be a more elegant way of performing this, but here's a one-liner I threw together for this task, in case anyone else ever needs to use it.

Edit: turns out there's a standard way to do this that already works well.

git ls-files --other [--exclude-standard]

Solution

  • Or...

    git clean -dnx | cut -c 14-
    

    If you don't want to see ignored files,

    git clean -dn | cut -c 14-