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.

Community
  • 1
  • 1
GreenAsJade
  • 14,459
  • 11
  • 63
  • 98

2 Answers2

3

Slight improvement to @GreenAsJade answer:

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

That works for zsh users.

justingordon
  • 12,553
  • 12
  • 72
  • 116
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]

GreenAsJade
  • 14,459
  • 11
  • 63
  • 98
  • 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. – Amadan Nov 27 '14 at 06:35
  • Thanks! I've updated accordingly. Can an assume-unchanged file have a merge pending? – GreenAsJade Nov 28 '14 at 06:36
  • Haha, you might be right! I totally didn't think. Also, incidentally, I blundered into [this](http://stackoverflow.com/questions/13630849/git-difference-between-assume-unchanged-and-skip-worktree), suggesting `skip-worktree` is a better option for this scenario. – Amadan Nov 28 '14 at 06:42
  • 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. – GreenAsJade Nov 28 '14 at 06:53