One Liner
git ls-files -v | grep "^[a-z]"
Use Aliases
IMHO, git hidden
is better for files marked as --assume-unchanged
:
git config --global alias.hidden '!git ls-files -v | grep "^[a-z]"'
Here's a list of related aliases I have in ~/.gitconfig
:
[alias]
hide = update-index --assume-unchanged
unhide = update-index --no-assume-unchanged
unhide-all = update-index --really-refresh
hidden = !git ls-files -v | grep \"^[a-z]\"
ignored = !git status -s --ignored | grep \"^!!\"
To make it work in subdirectories and support arguments:
hidden = "!f(){ git -C \"$GIT_PREFIX\" ls-files -v \"$@\" | grep \"^[a-z]\";}; f"
ignored = "!f(){ git -C \"$GIT_PREFIX\" status -s --ignored \"$@\" | grep \"^!!\";}; f"
For example:
# cd target
# git ignored classes
About File Status
For me most hidden files are marked with flag h
, though there're actually several other flags according to the manual of git-ls-files
-v
:
-v
Similar to -t, but use lowercase letters for files that are
marked as assume unchanged (see git-update-index(1)).
About git ls-files
-t
:
This option (-t) identifies the file status with the following tags
(followed by a space) at the start of each line:
H cached
S skip-worktree
M unmerged
R removed/deleted
C modified/changed
K to be killed
? other