Ignoring an already checked-in directory’s contents?

This command will cause git to untrack your directory and all files under it without actually deleting them:

git rm -r --cached <your directory>

The -r option causes the removal of all files under your directory.

The --cached option causes the files to only be removed from git’s index, not your working copy. By default git rm <file> would delete <file>.

Leave a Comment