While VonC's answer is certainly correct and will help with the imminent problem, I feel the need to elaborate and explain the underlying issue.
Background
Git's sparse-checkout
makes use of the skip-worktree
bit, which basically tells git to consider the file in your working directory to be "up to date", regardless of the true state.
When using sparse-checkout
git will apply this bit to all files which do not match the patterns described in your sparse-checkout
file. When disabling sparse-checkout
, or deleting the pattern file, this bits will still be set and the files won't return. You can read about it here.
As such you have to remove the skip-worktree
bit manually from the files in question. The easiest approach certainly being the suggestions from VonC.
But why?
The reasoning behind this is quite simple. The skip-worktree
bit is not exclusively used for sparse-checkout
but it's rather a tool in git's toolkit. Other processes make use of the same bit, or a user might even use it own his own (personally I use it regularly to ignore changes to configuration files when debugging).
On a sidenote: You can actually get a list of the files which have been flagged with the skip-worktree
bit, by using git ls-files -v
. This will list all files under version control; the files with the skip-worktree
bit are prefixed with a S
.
If you only want to list the skip-worktree
flagged files you can easily parse and grep the list with the following command: git ls-files -v | grep '^S' | cut -d' ' -f2
.