I have an file abc.log that is (for some reason) tracked in git, but that I (perhaps foolishly) set as --skip-worktree so changes to it would not show up in my commits to the repository. I would like to change branches:
~ % git checkout master
error: Your local changes to the following files would be overwritten by checkout:
abc.log
Please commit your changes or stash them before you switch branches.
Aborting
I then try to refresh the index and force-checkout:
~ % git update-index --really-refresh
~ % git checkout master -f
error: Entry 'abc.log' not uptodate. Cannot merge.
However, abc.log does not have any changes on local:
~ % git status
On branch xyz
Your branch is ahead of 'origin/xyz' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
Following Undo git update-index --assume-unchanged <file>, I try to set it as no-skip-worktree again.
~ % git update-index --no-skip-worktree --no-assume-unchanged abc.log
fatal: Unable to mark file dump.rbd
Following the advice of something like https://stackoverflow.com/a/42363882 I see that it is tracked by git, and currently set to skip worktree
~ % git ls-files -v | grep "S "
S abc.log
However, simply looking for it doesn't show it
~ % git ls-files --error-unmatch abc.log
error: pathspec 'abc.log' did not match any file(s) known to git
Did you forget to 'git add'?
And I am unable to add it as follows
~ % git add dump.rbd
fatal: pathspec 'abc.log' did not match any files