How can I tell which files have been marked as "assume unchanged" in git
Asked Answered
D

2

3

This answer shows you how to mark a file that is managed by git as "I don't want changes from the repo for this file" - IE to have your own local untracked version of that file, even though it remains under revision control by git in the remotes.

The question is "How can I tell which files have been marked this way?" ... a good thing to be able to check, if you are using this feature!


Note: mentioned in comments below, skip-worktree is probably a better tool for the job than assume-unchanged. Nonetheless, this question documents how to find assume-unchanged files.

Diagenesis answered 27/11, 2014 at 4:15 Comment(0)
D
2

... the answer was provided in comments of the answer linked above: git ls-files -v will show "assume unchanged" files as lower case letter.

So you can find them like this:

git ls-files -v | grep ^[a-z]

Diagenesis answered 27/11, 2014 at 4:16 Comment(4)
Almost but not quite. It would be c if the file is changed, for example (as opposed to C), m if the file has a merge pending (as opposed to M) etc. The unchanged assumption is marked by lowercase, but not necessarily a lowercase h. See -t and -v options in git help ls-files. grep ^[a-z] is much more appropriate.Les
Thanks! I've updated accordingly. Can an assume-unchanged file have a merge pending?Diagenesis
Haha, you might be right! I totally didn't think. Also, incidentally, I blundered into this, suggesting skip-worktree is a better option for this scenario.Les
Yeah - it does appear that skip-worktree is better suited. Meanwhile, I'm guessing that ^h is probably sufficient OK, since the file is never seen as changed, but ^[a-z] is probably safe anyhow.Diagenesis
S
3

Slight improvement to @GreenAsJade answer:

git ls-files -v | grep "^[a-z]"

That works for zsh users.

Sabrasabre answered 13/4, 2015 at 1:8 Comment(0)
D
2

... the answer was provided in comments of the answer linked above: git ls-files -v will show "assume unchanged" files as lower case letter.

So you can find them like this:

git ls-files -v | grep ^[a-z]

Diagenesis answered 27/11, 2014 at 4:16 Comment(4)
Almost but not quite. It would be c if the file is changed, for example (as opposed to C), m if the file has a merge pending (as opposed to M) etc. The unchanged assumption is marked by lowercase, but not necessarily a lowercase h. See -t and -v options in git help ls-files. grep ^[a-z] is much more appropriate.Les
Thanks! I've updated accordingly. Can an assume-unchanged file have a merge pending?Diagenesis
Haha, you might be right! I totally didn't think. Also, incidentally, I blundered into this, suggesting skip-worktree is a better option for this scenario.Les
Yeah - it does appear that skip-worktree is better suited. Meanwhile, I'm guessing that ^h is probably sufficient OK, since the file is never seen as changed, but ^[a-z] is probably safe anyhow.Diagenesis

© 2022 - 2024 — McMap. All rights reserved.