2

No matter which gitignore I use, whever its from gitignore.io, official github, .gitignores copied from popular public repositories, it wont ignore useless folders and files such as obj, package caches, .idea folder related files, etc.

Files I want to ignore, but are still showing up as changes:

<project-path>\obj\project.nuget.cache
<project-path>\obj\Debug\netcoreapp3.1\ProjectName.AssemblyInfo.cs
<project-path>\obj\Debug\netcoreapp3.1\ProjectName.csproj.nuget.g.props

Current gitignore:

### DotnetCore ###
# .NET Core build folders
/bin
/obj

# Common node modules locations
/node_modules
/wwwroot/node_modules


### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

.idea/
*.sln.iml
  • my guess: you've once commited those files _before_ you commited your .gitignore? in that case, [this](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) might help. – Franz Gleichmann Sep 09 '20 at 20:03

1 Answers1

3

this happens for me sometimes,

I do this to fix

git rm -r --cached . 
git add .
git commit -m "fix gitignore file"
Ali Faris
  • 17,754
  • 10
  • 45
  • 70