git remove tracked file without deleting code example Example: git remove tracked files without deleting git rm --cached -r mydirectory