I ran into an issue with changed files not being detected by git status
or git add
, much the same as was answered here. The top answer there mentioned that the file(s) may have been marked as 'assume unchanged', which makes sense.
I'm curious if there's a good way in Git CLI to list all files in the index currently marked with this bit.
(Bonus: It would also be nice to be able to list files marked with the "skip-worktree" bit~)
git update-index
, finding no clues or further reading.git help -a | grep index
to look for any index-related commands that might be able to do what I'm asking. Not seeing any fruit here.You can use the -v
option to git ls-files
:
-v
-- Similar to -t, but use lowercase letters for files that are marked as assume unchanged (see git-update-index(1)).
So e.g., if I have a repository with a modified file, I might see something like this from git status
:
$ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: examplefile
no changes added to commit (use "git add" and/or "git commit -a")
If I mark that file as --assume-unchanged
:
$ git update-index --assume-unchanged examplefile
Then git status
now reports:
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
At this point, running git ls-files -v
shows:
H README.md
h examplefile
Note the lowercase h
in front of examplefile
. If I remove the assume-unchanged
setting:
$ git update-index --no-assume-unchanged examplefile
Then git ls-files -v
shows:
$ git ls-files -v
H README.md
H examplefile