git cached remove code example Example 1: git clean cache $ git rm -r --cached . Example 2: git remove cached directory git rm -r --cached [directory]