remove directory from git without deleting

C++
# for single file
git rm --cached myfile

# for directory file
git rm --cached --r myfile#for directory
git rm --cached -r myfile
Source

Also in C++: