How to list files ignored with ‘skip-worktree’

Use the following command if on *nix (Linux, Mac):

git ls-files -v . | grep ^S

or, if on Windows, you can use:

git ls-files -v . | findstr "^S"

Explanation:
git ls-files . lists all files in the repo (assuming you are in the root folder). -v makes the output verbose, meaning that it will abbreviate the file status with a letter in front of the filename. The options are:

H cached

S skip-worktree

M unmerged

R removed/deleted

C modified/changed

K to be killed

? other

Documentation

So, to only list files with skip-worktree flag, the output is piped to grep with ^S as argument, meaning that only lines beginning with S are listed.

Leave a Comment