I have an existing Visual Studio project in my repository. I recently added a .gitignore file under my project and I assume that tells Git to ignore the files listed in the file.
My problem is that all those files are already being tracked and as far as I know Git will not ignore a file that was already tracked before a rule was added to this file to ignore it.
It was suggested to use: git rm --cached
and manually un-track them but that's going to take me forever to go through them one by one.
I thought about deleting the repository and recreating it again but this time with .gitignore file present, but there must be a better way to do this.
git rm --cached
entire directories with the-r
option, if that's helpful – Nathan Wallace