How to remove files but keep them locally ?

One of the possible solutions for this problem is...git rm. But defined as it, it will remove both, remote and local files. To remove file from repository but keep them as untracked locally, --cached flag must be specified.

So, to remove readme.txt file from index but keep it locally, we should call:

git rm --cached readme.txt  

It works only for directories, with supplementary -r flag:

git rm --cached -r sources/