how to remove changes tracked by git code example Example: git remove tracked files without deleting git rm --cached -r mydirectory