Search code examples
githubgitignoreasp.net-core-3.1

gitignore is not ignoring the files I added


The code below is what I have tried in the .gitignore file. Other folders when I put logs or **/wwwroot and save the file, every file in the folder is ignored but this object folder in the core project is not ignored somehow.


obj/project.assets.json
obj/Debug/netcoreapp3.1/CDS.PORTAL.assets.cache
obj/Debug/netcoreapp3.1/CDS.PORTAL.csproj.FileListAbsolute.txt
obj/Debug/netcoreapp3.1/CDS.PORTAL.csprojAssemblyReference.cache
obj/Debug/netcoreapp3.1/staticwebassets/CDS.PORTAL.StaticWebAssets.Manifest.cache
obj/Debug/netcoreapp3.1/staticwebassets/CDS.PORTAL.StaticWebAssets.xml

Screenshot of VS Code


Solution

  • The M next to the file names in VS Code stands for Modified. See git status modes.

    Seems like at some point you've added those files to git, then added those entries to .gitignore later. git now knows those files exist and keeps track of them, and doesn't automatically rewrite, even though you have a new .gitignore list.

    If you still want to do this, check this similar question: How to make Git "forget" about a file that was tracked but is now in .gitignore?