{ Git – Stop tracking }

I ran into an issue where I accidentally added a large number of files to a repository (think node_modules) that were supposed to be ignored.

If caught before committing, this command seems to do the trick:

git rm --cached files/\*

This leaves the files themselves alone so you don’t lose any work, but it stops Git from actively tracking them. The /\* applies the command to all files in the “files” directory, with the back slash to escape the * character.