Reputation: 41236
What have I marked as --assume-unchanged
? Is there any way to find out what I've tucked away using that option?
I've dug through the .git/
directory and don't see anything that looks like what I'd expect, but it must be somewhere. I've forgotten what I marked this way a few weeks ago and now I need to document those details for future developers.
Upvotes: 396
Views: 59976
Reputation: 2373
This command works more consistently for me. It will print only the files that are listed as 'assume-unchanged'.
git ls-files -v|grep "^h"
I've used this lots of times in different environments and it works perfectly.
Upvotes: 30
Reputation: 17391
git ls-files -v | grep "^[a-z]"
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
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
Upvotes: 95
Reputation: 40730
You can use git ls-files -v
. If the character printed is lower-case, the file is marked assume-unchanged.
To print just the files that are unchanged use:
git ls-files -v | grep '^[[:lower:]]'
To embrace your lazy programmer, turn this into a git alias. Edit your .gitconfig
file to add this snippet:
[alias]
ignored = !git ls-files -v | grep "^[[:lower:]]"
Now typing git ignored
will give you output like this:
h path/to/ignored.file
h another/ignored.file
Upvotes: 526
Reputation: 407
PowerShell solution, using Select-String \ sls
git ls-files -v | sls -pattern ^h -casesensitive
Upvotes: 11
Reputation: 1255
Windows command line solution using findstr:
git ls-files -v | findstr /B h
Upvotes: 13