git remove keep local code example
Example 1: remove folder from repo but keep locally
git rm -r --cached File-or-FolderName
git commit -m "Removed folder from repository"
git push origin master
Example 2: remove directory from git without deleting
#for directory
git rm --cached -r myfile