I've recently started using .NET Core and git ignore. The original project that was created has the .gitignore and seems to work ok. However, upon adding new projects to the solution, when i try and commit there are lots of unwanted changes that the .gitignore file covers but doesn't apply to the new projects. I've copied the ignore file into the new projects but the unwanted files still appear. Any thoughts?
It’s likely that your file is already tracked by Git. You can confirm this through the output of git status. If the file is not listed in the “Untracked files” section, then it is already tracked by Git and it will ignore the rule from the .gitignore file.
In order to actually ignore the file, you have to untrack it and remove it from the repository. You can do that by using
git rm --cached fileToRemove
This removes the file from the repository without physically deleting the file (that’s what the --cached does).