How to remove file from being tracked by git code example Example: git remove tracked files without deleting git rm --cached -r mydirectory