git remove a tracked directory from repo without deleting locally code example
Example 1: git remove tracked files without deleting
git rm --cached -r mydirectory
Example 2: remove tracked files git
git rm --cached <file>
git rm --cached -r mydirectory
git rm --cached <file>